Skip to content
Snippets Groups Projects
Commit 4bcf269a authored by Jim Birch's avatar Jim Birch Committed by Mike Herchel
Browse files

Issue #3021756 by thejimbirch: Documentation for composer install

parent 9641e22a
No related branches found
No related tags found
No related merge requests found
......@@ -2,76 +2,101 @@
## What is Quicklink?
The Quicklink module loads the [Quicklink library](https://github.com/GoogleChromeLabs/quicklink) and provides a Drupal
administrative interface to configure it.
The Drupal Quicklink module loads the
[Quicklink library](https://github.com/GoogleChromeLabs/quicklink) and provides
a Drupal administrative interface to configure it.
## Installation
Install the module like normal. Because of licensing restrictions, the Quicklink JS library cannot be hosted on Drupal.org.
By default the module will load the Quicklink library from a CDN at `https://unpkg.com/quicklink@1.0.0/dist/quicklink.umd.js`.
If you place a copy of this file into your local filesystem at `/quicklink/js/quicklink.umd.js`, the module will serve this
instead.
## How do I access the Quicklink admin interface?
### Manual Installation
1. Download the Drupal module and extract it to your modules folder.
2. Because of licensing restrictions, the Quicklink JavaScript library cannot
be hosted on Drupal.org.
The Quicklink module admin interface is located at `admin/config/quicklink/quicklinkconfig`.
By default this module will load the Quicklink JavaScript library from a CDN at
`https://unpkg.com/quicklink@1.0.0/dist/quicklink.umd.js`.
## What browsers does this support?
If you place a copy of this file into your local filesystem at
`/libraries/quicklink/dist/quicklink.umd.js`, this module will serve the local copy
instead of the CDN copy.
Without polyfills: Chrome, Firefox, Edge, Opera, Android Browser, Samsung Internet.
With [Intersection Observer polyfill](https://github.com/w3c/IntersectionObserver/tree/master/polyfill): Safari, IE9+
### Composer (recommended)
If you manage your site with composer, and would like to install this module
with it, please verify the following steps. If you used the [Drupal composer
template](https://github.com/drupal-composer/drupal-project) to setup your
project, you most likely have this set up already.
## How to ignore certain links.
1. Add or verify that `asset-packagist` is in the repositories section of your
composer.json file:
You can tell Quicklink to ignore certain links by adding them into the ignore list at `admin/config/quicklink/quicklinkconfig`.
In addition, you can add a `noprefetch` attribute onto the `<a>` tag to tell the library not to prefetch this link.
## Installation via Composer
```
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "composer",
"url": "https://asset-packagist.org"
},
}
```
Add the following into your webroot's `composer.json` file to automatically download the `quicklink.umd.js` file so it
can be served from your system's local filesystem.
2. Add or verify that `type:npm-asset` is in the `extra` > `installer-path` >
`web/libraries/{$name}` section of your composer.json file:
```
"require": {
"GoogleChromeLabs/quicklink": "^1.0"
},
"repositories":[
{
"type":"composer",
"url":"https://packages.drupal.org/8"
},
{
"type": "package",
"package": {
"name": "GoogleChromeLabs/quicklink",
"version": "1.0.0",
"type": "drupal-library",
"dist": {
"url": "https://unpkg.com/quicklink@1.0.0/dist/quicklink.umd.js",
"type": "file"
"extra": {
"installer-paths": {
"web/libraries/{$name}": [
"type:drupal-library",
"type:bower-asset",
"type:npm-asset"
],
}
}
}
]
```
You'll need to ensure that the `drupal-library` type is available under the `extras` section of the composer.json. The
code snippit below assumes that you have your webroot in a `web` subdirectory.
3. Add or verify that you have `npm-asset` in the `extra` > `installer-types`
section of your composer.json file:
```
"extra": {
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/{$name}": ["type:drupal-drush"]
},
"patches": {}
}
"installer-types": ["npm-asset", "bower-asset"],
```
After your `composer.json` is in order, you can install the library with `composer require GoogleChromeLabs/quicklink`,
and you can install the Quicklink module with `composer require drupal/quicklink`
\ No newline at end of file
4. Save your composer.json file.
5. Back at the command line, install the library with
`composer require oomphinc/composer-installers-extender npm-asset/quicklink`
6. Install the module with `composer require drupal/quicklink`
7. Enable the module at `admin/modules` or by running `drush en -y quicklink`
## How do I access the Quicklink admin interface?
The Quicklink module admin interface is located at
`admin/config/quicklink/quicklinkconfig`.
## What browsers does this support?
Without polyfills:
Chrome, Firefox, Edge, Opera, Android Browser, Samsung Internet.
With [Intersection Observer polyfill]
(https://github.com/w3c/IntersectionObserver/tree/master/polyfill):
Safari, IE9+
## How to ignore certain links.
You can tell Quicklink to ignore certain links by adding them into the ignore
list at `admin/config/quicklink/quicklinkconfig`.
In addition, you can add a `noprefetch` attribute onto the `<a>` tag to tell
the library not to prefetch this link.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment