redactor-rails icon indicating copy to clipboard operation
redactor-rails copied to clipboard

Asset pipeline issue

Open 6twenty opened this issue 12 years ago • 12 comments

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

6twenty avatar Aug 20 '12 10:08 6twenty

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

6twenty avatar Aug 20 '12 10:08 6twenty

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.

thebrokencube avatar Aug 20 '12 16:08 thebrokencube

@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.

rubinsh avatar Aug 22 '12 07:08 rubinsh

@SammyLin Is this on the radar? Would be good to have this in the gem itself - rather than fixing it as above.

nishantmodak avatar Oct 17 '12 08:10 nishantmodak

:+1:

I got same problem.

moro avatar Nov 26 '12 09:11 moro

:+1: Same issue

softwhisper avatar Feb 20 '13 18:02 softwhisper

:+1: Same here

andreivolt avatar Feb 22 '13 12:02 andreivolt

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?

aisensiy avatar Mar 07 '13 16:03 aisensiy

same issue

milushov avatar May 08 '13 14:05 milushov

+1 for @6twenty's solution

scottweisman avatar Jun 12 '13 03:06 scottweisman

+1 I had the same problem. Used @6twenty's solution to work around the bug.

jeremyhaile avatar Jul 26 '13 23:07 jeremyhaile

:+1:

mojibakeo avatar Jun 10 '15 13:06 mojibakeo