0
votes

I have a large project using CKEditor that is built using the requirejs optimizer (http://requirejs.org/docs/optimization.html) to combine all javascript into a single .js file. Individual modules like jquery and ckeditor and others are 'required' in using requirejs.

Everything works great except for ckeditor. Right now I have to 'exclude' ckeditor from the single combined .js file ('exclude' is an option to the requirejs optimizer).

My require config looks like this:

requirejs.config({
  'baseUrl': '/myapp/',
  paths: {
    'scs-core-libs': '../../core/src/libs',

    'knockout':  '../../core/src/libs/knockout/dist/knockout',
    'jquery':    '../../core/src/libs/jquery/dist/jquery.min',
    'jquery-ui': '../../core/src/libs/jquery-ui/ui',
    'ckeditor':  '../../core/src/libs/ckeditor/ckeditor'
    ...
  }
  ...
});

I have to exclude ckeditor from the optimizer because otherwise ckeditor isn't able to find my plug-ins, my language files, or even the main config.js file.

var requireJsOptimizerConfig = {
  baseUrl: './src',
  exclude: [
    'scs-core-libs/ckeditor/ckeditor'
  ],
  ...
}

I tried CKBuilder, but that didn't help. Is CKEditor not friendly with the requirejs optimizer? Has anyone been able to get all of CKEditor gulped up into a single application .js file?

Basically I want to be able to remove that 'exclude' line.

1

1 Answers

2
votes

You need to set CKEDITOR_BASEPATH as a global variable somewhere before you require the editor.

 var CKEDITOR_BASEPATH = '/path/to/your/installation/of/ckeditor/';

http://docs.ckeditor.com/#!/guide/dev_basepath