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

How to support rails 4 asset pipeline

Open jerryshen opened this issue 11 years ago • 8 comments

not working on production mode.

jerryshen avatar Dec 04 '13 02:12 jerryshen

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

ChrisSki avatar Dec 13 '13 15:12 ChrisSki

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.

izakfilmalter avatar Dec 31 '13 09:12 izakfilmalter

I'll work on that soon.

wilgoszpl avatar Feb 08 '15 22:02 wilgoszpl

+1

Thanks for the temporary fix izakfilmalter

activestylus avatar Feb 11 '15 19:02 activestylus

+1

Thanks for the temp fix izakfilmalter

arun057 avatar Apr 28 '15 18:04 arun057

+1

jaymiejones86 avatar Apr 30 '15 10:04 jaymiejones86

:+1:

antonpaisov avatar Aug 26 '15 18:08 antonpaisov

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.

toxis avatar Oct 18 '15 18:10 toxis