In our build process (using grunt), we concatenate, minify and uglify all our scripts into a single one (also meaning a single request only).
Now CKEditor 4 seems to be
I implemented suggestions 2 and 3 from Reinmar's answer - here's how I did it:
- "Editor UI stylesheet file can be perhaps concatenated with your page's stylesheets, but you'll have to find a way to prevent editor from loading it by itself"
var swap = CKEDITOR.skin.loadPart;
CKEDITOR.skin.loadPart = function(res, callback) {
if (res == 'editor') {
console.log('Ignoring editor.css load');
callback && callback();
return;
}
swap(res, callback);
}
I then bundled editor.css
into my bundled file.
- Contents stylesheet - you can remove it even if you use framed editor, but you'll need to style contents using the fullPage feature (not recommended).
// I copied the content.css from ckeditor-dev and loaded it into contentCss.
var contentCss = 'put your css here';
var config = {
// Other things here
// ...
contentCss: contentCss
};
ckeditor.replace(element, config);
Both are done at initialization time (in my code they're in the function that calls ckeditor.replace
, as shown in 3).
These are most certianly hacks, but for my current use the optimizations enabled by these hacks are worth it.
Also, in lieu of implementing suggestion 1., I prevent other js
files from loading by setting customConfig: ''
and stylesSet: false
in the config.
CKEditor works in two modes:
In the development (source) mode:
ckeditor.js
file,config.js
(you can switch that off by setting config.customConfig to a falsy value),false
(since 4.1RC) or an array of styles (direct setting),In release (build) mode, which you can create using the online builder, or the presets builder or the dev builder available directly in the dev repo, things are optimized:
ckeditor.js
file,config.js
and styles.js
files are downloaded separately, but like in the development mode you can save these 2 HTTP requests,Note: all JS and CSS files are minified in the release mode.
You can try to optimize few things.
ckeditor.js
with language file, dialogs and PSW filter files - so all JS files may be concatenated together AFAIK.That's all, I guess. I think that by default a CKEditor build is optimized very well. You can improve some things but you will not save a lot of time and you'll lose some features like automatic language recognition.