Asset pipeline issue #16

Open
6twenty opened this Issue Aug 20, 2012 · 12 comments

Comments

Projects
None yet

6twenty commented Aug 20, 2012

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 commented Aug 20, 2012

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.

Contributor

rubinsh commented Aug 22, 2012

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

moro commented Nov 26, 2012

👍

I got same problem.

@ghost

ghost commented Feb 20, 2013

👍 Same issue

👍 Same here

aisensiy commented Mar 7, 2013

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?

milushov commented May 8, 2013

same issue

+1 for @6twenty's solution

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment