ckeditor/ckeditor4-presets

Plugins included via local build different from online builder.

WrathOfZombies opened this issue ยท 5 comments

Here's the plugin build config that I am trying to use. Its a customized version of the basic build config. When I use the build process to generate the compiled files, the plugins included in the plugin folder are different from those included when using https://ckeditor.com/builder.

Any reason why this is so? I am doing something wrong?
basic-build-config.txt

Hello @WrathOfZombies,
I used your config file to generate 3 builds:

  • via online builder - source files (not bundled)
  • via online builder - optimized
  • via ckeditor-presets running build.sh basic

The result is as follows:
screen shot 2017-09-27 at 11 31 10

So the first build has all plugins in the plugins/ directory as it is a Source version. If you look at optimized version from online builder (second) and the one generated via ckeditor-presets (third), still the list of plugins is the same.

When build is bundled all plugin.js files are concatenated in ckeditor.js so if the plugin folder contains only these file, the folder is simply removed from the build. That's the reason there is difference between Source and Optimized version in plugins/ folder.


Comparing optimized version, the CKEDITOR.plugins list is the same, however looking at the toolbar I can see that ckeditor-presets build does not include clipboard and undo buttons by default:

screen shot 2017-09-27 at 11 41 27

The problem here is default config.js file for basic preset which contains:

// The default plugins included in the basic setup define some buttons that
// are not needed in a basic editor. They are removed here.
config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';

so that this buttons are not visible. And if you look at the config.js file from the builder:

// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';

So when using online builder with custom build config, the config.js is based on standard preset, so for ckeditor-presets you should customize standard-build-config.js to get exactly same result. Or you may simply edit basic-ckeditor-config.js

Thanks @f1ames. This is what I was looking for - When build is bundled all plugin.js files are concatenated in ckeditor.js.. That explains why I am seeing lesser amount of plugins. One more question,

In my build using ckeditor-presets I can see that colorbutton plugin is not explicitly copied to plugins, where as a standard download of ckeditor/4.7.3 (https://unpkg.com/ckeditor@4.7.3/plugins/colorbutton/) shows that colorbutton is included explicitly. Is this due to the fact that the npm package includes all plugins and isn't the most optimized version?

If you look at the npm section in Installing CKEditor with Package Managers docs on the very end of the section:

Currently only the standard-all CKEditor installation preset can be fetched.

The standard-all is like the standard package so all plugins from build-config are bundle into ckeditor.js, but additionally all other plugins (that's the -all part in the package name) are just copied to plugins directory, so you can include them by modifying config or using extraPlugins option (as they are not added by default).

Is there a way to tell the builder to completly ignore a plugin (that is not a dependency) or does it work this way ?

  • Every folder on plugins directory will be inevitably included in the final build.
  • If a plugin "x" is indicated in the build-config.js, the "plugins/x/plugin.js" file will be minified and added to the final ckeditor.js and removed from the final "plugins/x" folder.
  • Otherwise the plugin folder will be copied as it is.

Just found my answer here : https://github.com/ckeditor/ckbuilder/blob/85f532623210ceba631d9c79e56f5554758076eb/src/assets/help.txt

  -s,--skip-omitted-in-build-config
                            exclude from release all plugins/skins
                            that are not specified in build-config