Closed freegenie closed 9 years ago
You will need to configure your web server to serve the .gz file if available and fall back to the non-.gz version. The request itself (for all assets, TinyMCE or otherwise) will never be for the .gz version.
My problem is that, while other rails assets precompiled leaving the digested filename in place, tinymce-rails deletes the digested copy for some reasone I don't understand.
For instance, when I run precompilation with Rails I get:
application.js application-1298789989asdsa97a9sd.js application-1298789989asdsa97a9sd.js.gz
While with tinymce-rails gem I get:
tinymce-content.js tinymce-content-1239082102132176asdasd.js.gz
As you can see I don't get:
tinymce-content-1239082102132176asdasd.js
which gets deleted. Why?
My rails app is hosted on heroku and uses sprockets-redirect to redirect the plain filename (tinymce-content.js) to the hashed filename version (tinymce-content-1239082102132176asdasd.js) which is missing and causes an error.
I solved the issue with a fork of this gem that doesn't delete the hashed non-gzipped version.
Since all TinyMCE assets are loaded dynamically (and these requests don't include the fingerprint), tinymce-rails removes the fingerprints from the filenames during precompile. It shouldn't be leaving the .gz
file -- that is a bug but shouldn't be affecting things.
I hadn't previously considered sprockets-redirect, but I just ran a test and everything seemed to work correctly, using the following versions:
rails: 4.1.6
sprockets: 2.11.0
sprockets-rails: 2.1.4
sprockets-redirect: 0.2.0
tinymce-rails: 4.1.5
In my test, I created a custom plugin at app/assets/tinymce/plugins/custom/plugin.js
, and added it to config.assets.precompile
. This is compiled to public/assets/tinymce/plugins/custom/plugin.js
(as well as the .js.gz
file with the digest which is ignored). The manifest file is also updated with the correct non-digested paths to the asset and in production mode, the asset is correctly loaded.
Are you able to post the versions of asset-related gems that you are using, or even better, upload a Rails app which exhibits the problem?
In production env, tinymce looks for plugins paths without .gz extension, so assets are not found. Any advice?