Building CKEditor 4 from Source Code
If you are working with the CKEditor 4 source code on your computer or in a local network, at some stage you will want to distribute it to your test or production environment.
Never distribute the source version of CKEditor 4 to production websites. There are serious performance implications of doing this.
Instead, you must create a CKEditor 4 “build” or “release version” (in contrast to the “source version”). It is an optimized, production-ready CKEditor 4 distribution.
# The dev/builder
Folder
The builder will only work on the source version of CKEditor cloned from the a Git repository (for example from the official CKEditor 4 development repository). It will not work on the project downloaded as a .zip
package.
The source code of CKEditor 4 contains a pre-configured environment that allows you to easily create editor builds.
The following are the most relevant files that you can find there:
build.sh
– the build runner Bash script.build-config.js
– the build configuration file.
# Step 1: Build Setup
Edit the build-config.js
file which contains the build configuration. It includes the following sections:
var CKBUILDER_CONFIG = {
// Skin name.
skin: '...',
// Files to be ignored.
ignore: [ ... ],
// Plugins to be included.
plugins: { ... }
};
The most important parts are the skin
name and the list of plugins
. These need to be set properly and include all the things you want to have in your build.
Some plugins might need others to work, but you do not have to resolve these dependencies by yourself as CKBuilder will do this for you.
# Step 2: Running the Builder
Go to the command line and call the build script:
./build.sh
The builder will be executed and the resulting build will be created in the dev/builder/build
folder.
# About CKBuilder (Command Line)
The building process is handled by the command line version of CKBuilder. It is a powerful application that makes several enhancements to the source code: it loads the configuration file, resolves plugin dependencies, merges and minifies files, creates icon strips, and performs many other build-related tasks.
For the first run, build.sh
will need to download CKBuilder and copy it into the dev/builder/ckbuilder/<ckbuilder version>
folder, so an Internet connection is required. Once the file is available, no more downloads are necessary (though if possible, the script will try to perform an update on consecutive runs).
The only requirement to run CKBuilder is Java.