Open amysutedja opened 9 years ago
I can't reproduce this here :disappointed:. Are you able to upload a test Rails app to a GitHub repo that exhibits the problem?
Okay, after a bunch of looking into it, I was able to solve the problem.
We had a setting in our assets.rb
file that looked like this.
Rails.application.config.assets.precompile += %w(png jpg jpeg gif)
This is to solve an issue in which Rails 4 apparently does not precompile images by default. However, we didn't realize that this also caused tinymce-rails
image assets to also be precompiled. Since the tinymce-rails
gem adds functionality to rake assets:precompile
to delete all digested assets, we ended up with a bunch of unresolvable references to digested assets in the manifest.
The solution was to change the line to the following:
Rails.application.config.assets.precompile += [/(?!.*tinymce).*(png|jpg|jpeg|gif)$/]
I'm glad you found a solution that works but I hope you can give me a little more feedback to help find the root cause.
This is to solve an issue in which Rails 4 apparently does not precompile images by default.
By default, Rails 4 should precompile application.js
, application.css
and any non-js/css files within app/assets. tinymce-rails adds tinymce.js
only to the precompile list.
Since the tinymce-rails gem adds functionality to rake assets:precompile to delete all digested assets, we ended up with a bunch of unresolvable references to digested assets in the manifest.
tinymce-rails (both 3.x & 4.x) extend the assets:precompile
task to do the following:
a) copies the vendored TinyMCE assets to public/assets
b) adds files from a) to the asset manifest
c) renames any digested files within public/assets/tinymce/
to their non-digested versions
d) updates the manifest with the new filenames from c)
It sounds like d) may not be happening correctly in your case. Do you have any other asset-related gems installed that may be interfering with the manifest during precompilation?
Hmm, interesting. The only ones I'm aware of are sass-rails
and compass-rails
. Would it help to have the Gemfile.lock
and assets.rb
files that we're using?
Yes please, that should hopefully shed some light on what's happening.
Okay, I've uploaded the relevant info to this Gist. Note that I've redacted some sensitive data from the files.
Thanks @amysutedja.
In your tinymce/themes/advanced/skins/tddc/*.css
source files, are there any references to icons.gif that use the asset helpers (e.g. image-url("tinymce/themes/advanced/img/icons.gif")
, etc.)?
Yes, there are indeed. One example:
a.browse span {
display: block;
width: 20px;
height: 18px;
background: asset-url('tinymce/themes/advanced/skins/default/img/icons.gif') -860px 0;
border: 1px solid #FFF;
margin-left: 1px;
}
I take it that this css file being added to the precompile list is causing icons.gif
to be digested?
Yes, that is almost certainly where the problem lies.
I will spend some more time figuring out how this can be addressed. Unfortunately it's not quite as simple as not removing the digested file, since both versions need to exist and both need to be in the manifest (which I'm not sure is possible).
We're in the middle of a significant Rails 4 transition, but we don't yet have the ability to move to TinyMCE 4, so we're using the tinymce-3 branch, which should be Rails 4-compatible.
However, when TinyMCE loads with the Advanced theme, it's missing the icons, and the Javascript console displays the error:
Based on my understanding, tinymce-rails attempts to skip the asset pipeline entirely, and just copies the undigested files directly to
public/assets
. Since this is the case, why is TinyMCE trying to load the digested version oficons.gif
versus the undigested version?