redactor-rails
redactor-rails copied to clipboard
How to support rails 4 asset pipeline
not working on production mode.
Are their any plans for this? I didn't use this gem because I have a rails 4 app deployed and I can't seem to get it working properly on Heroku. Looks like the paths are wrong. Seems like this gem has that figured out.
Note: I'm also using active admin
This was a huge pain in the butt. Here's my solution:
In your application css file add:
@import "redactor-rails"
Note, I'm using sass so for a regular css file it will be different.
Then within you application.rb make sure that you compile the assets in the proper order. Mainly have redactor compile first.
config.assets.precompile += ['redactor-rails/*', 'print.css', 'cocoon.js', 'admin.css', 'admin.js', 'application.css', 'application.js']
Finally run:
rake assets:precompile --trace
I use trace as a just in case.
Then deploy to heroku or what ever.
Now that you have the solution let me explain why this works. Redactors assets will not be added into the precompiled css files if it is not compiled before they are. Also they are not compiling in the heroku push properly, I'm using a custom deploy strat so it may be different for y'all. Remember to precompile before heroku push.
I'll work on that soon.
+1
Thanks for the temporary fix izakfilmalter
+1
Thanks for the temp fix izakfilmalter
+1
:+1:
For Rails 4.x in production and with a custom config, I have to replace this line in application.js:
//= require redactor-rails
By these lines:
//= require redactor-rails/redactor
//= require redactor-rails/config
To explicitly say use my own config.js and not the default config.