redactor-rails
redactor-rails copied to clipboard
Asset pipeline issue
rails generate redactor:config
generates the file app/assets/redactor-rails/config.js
. This will not work in the asset pipeline correctly as the rake assets:precompile
task will still take config.js
from the gem instead of the app (note that it'll work fine in development though). See http://stackoverflow.com/questions/7829726/overriding-backend-assets-in-production-environment
The solution is to create your own config.js
(or any file name) and put it anywhere in your app's assets. Then when requiring redactor, instead of //= require redactor-rails
, use:
//= require redactor-rails/redactor.min
//= require path/to/custom/config
Alternatively you could keep the initial require statement the same, but instead of overriding redactor-rails/config.js
, you need to override redactor-rails/index.js
instead and use the following lines in it:
//= require ./redactor.min
//= require path/to/custom/config
A solution for this gem could be for the rails generate redactor:config
command to generate a custom redactor-rails/index.js
instead of redactor-rails/config.js
I actually ran into this problem too. What I did is just create a new event listener, such as $(".redactorbox")
instead of $(".redactor")
. It's not the most elegant solution, but it was a quick fix (oh deadlines) until I could figure out a better solution.
@6twenty - I've had the same issue, solved it the way you did, and was about to open the same issue and then I ran into yours :-)
@SammyLin - please solve - I agree with @6twenty's solution.
@SammyLin Is this on the radar? Would be good to have this in the gem itself - rather than fixing it as above.
:+1:
I got same problem.
:+1: Same issue
:+1: Same here
But there is only config.js in my app/assets/redactor-rails folder and i can't find any other file about redactor... where are they?
same issue
+1 for @6twenty's solution
+1 I had the same problem. Used @6twenty's solution to work around the bug.
:+1: