I have a project which uses CKEditor within Requirejs, and the Gruntjs for build, after build the CKEditor is not loaded and the DevTools of Chrome inform:
1:
Resource interpreted as Script but transferred with MIME type text/html: "http://editor.mwnewsletter/" (obs: this is the base url where I load CKEditor script and a custom config in an ckeditor-config.js file)
2:
Uncaught SyntaxError: Unexpected token <
(Obs.: This error inform my index.html line 1 as the problem source, but this line on .html is the doctype <!DOCTYPE html> markup)
I tried to remove every compact or uglify task on grunt config to see if was a problem with it but without success.
Does someone have this kind of issue too?
Thanks.
I ran into this as well.
I ran into this as well.
For me, the issue was being caused because the result of my grunt build (the contents of the dist folder) didn't contain all of the files required by CKEditor. It bundled up the ckeditor.js file but misses out the other files in the ckeditor package (how would it know to include them?)
My HTML looked like this:
<!-- build.js scripts/vendor.js -->
...
<script src="scripts/thirdparty/ckeditor/lib/ckeditor.js"></script>
<!-- endbuild -->
Grunt dutifully minified and concatenated my vendor scripts (including ckeditor.js) into a vendor.js file and copied it into the dist directory.
However, CKEditor needs more than just ckeditor.js to work (it loads other files).
I worked around this by moving the script tag outside of the grunt build section of my HTML file so that it isn't picked it up by the grunt tasks. Then, I modifyed the grunt copy task to copy the whole ckeditor dir to the dist dir:
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'images/{,*/}*.{webp}',
'fonts/*',
'scripts/thirdparty/ckeditor/**/*'
This is just a "get it working" solution. I'm new to CKEditor (I installed it today) and I need to get this working. This solution has introduced a lot more files into my dist folder so it would be nice to have this all concated/minified into my vendor.js file at some point. At the very least, I should exclude the samples folder and the readme, license etc. One for another day though!