I am working on an install profile that needs some CKEditor plugins. For example. the template plugin. You can add the module no problem:
composer require drupal/wysiwyg_templates
Getting the JS plugin seems to be a bit harder. There seem to be 3 options:
- Using composer:
{ "repositories": [ { "type": "composer", "url": "https://packages.drupal.org/8" }, { "type": "package", "package": { "name": "ckeditor/templates", "type": "drupal-library", "version": "4.5.7", "dist": { "type": "zip", "url": "http://download.ckeditor.com/templates/releases/templates_4.5.7.zip", "reference": "master" } } } ] }
- Using a manual install:
Download a tarball from the CKEditor site and unpack it into the
web/sites/libraries
directory.
- Ship plugins within the codebase:
Drupal core ships with some libraries in its codebase, are distributions allowed to do that too? (In this case, CKEditor plugins are GPL code.)
The problem with approach 1 is that all projects based on your distribution need to have that in their composer.json
file too. If you wanted a couple of plugins, you how have to include an extra 12-or-so lines in every composer.json
that uses your project. If you wish to add a new library you break all existing projects.
The problem with approach 2 is that you're adding a manual setup step in addition to composer install
. Very undesirable.
The problem with approach 3 is that it might not be allowed, and you might have trouble getting contrib modules to find these libraries based on the install location in vendor
. Still, it seems like the only option that might allow you to work around the boilerplate and manual download/update issues.
If there are any examples of a distribution handling this nicely that would be appreciated.