0

I am shimming CKEdtior to use within my CommonJS modular javascript package. The issue that I'm having is that the CKEditor assets are being cached somewhere along the line. I think it's browserify, but I'm not entirely sure.

A cached asset is as such:

<script type="text/javascript" src="http://192.168.68.8/cart-admin/ckeditor_4.5.6/config.js?t=FB9E"></script>

This asset is not manually put on the page, it's generated by CKEditor when the JS module runs it's course.

As is seen above, the query string caches the asset. However, if I update config.js the asset is still cached and the old version is served. Even if I re-build my javascript module, the query string cache stays the same and I'm stuck with old assets.

Is there a way to break it? Or am I going about this incorrectly?

package.json

"browser": {
  "ckeditor": "./ckeditor_4.5.6/ckeditor.js",
  "ckjquery": "./ckeditor_4.5.6/adapters/jquery.js"
},
"browserify-shim": {
  "ckeditor": "ckeditor",
  "ckjquery": "ckjquery"
}

JS module

window.CKEDITOR_BASEPATH = 'ckeditor_4.5.6/';
require('ckeditor');
require('ckjquery');
Gurnzbot
  • 3,742
  • 7
  • 36
  • 55

1 Answers1

0

I found the answer here: Force CKEDITOR to refresh config

I changed the requires as such:

window.CKEDITOR_BASEPATH = 'ckeditor_4.5.6/';
require('ckeditor');
require('ckjquery');
CKEDITOR.timestamp='';

CKEDITOR.timestamp=''; was the key. Now the ?t= caching string is no longer appended the asset urls.

Not sure if this is "correct", but it ensures I'm using the most up-to-date files. perhaps in production I'll add a versioned query string...

Community
  • 1
  • 1
Gurnzbot
  • 3,742
  • 7
  • 36
  • 55