SammyLin / redactor-rails

This repo is deprecated. Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails
MIT License
389 stars 253 forks source link

How to support rails 4 asset pipeline #104

Open jerryshen opened 10 years ago

jerryshen commented 10 years ago

not working on production mode.

ChrisSki commented 10 years ago

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

izakfilmalter commented 10 years ago

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.

wilgoszpl commented 9 years ago

I'll work on that soon.

activestylus commented 9 years ago

+1

Thanks for the temporary fix izakfilmalter

arun057 commented 9 years ago

+1

Thanks for the temp fix izakfilmalter

jaymiejones86 commented 9 years ago

+1

antonpaisov commented 9 years ago

:+1:

toxis commented 8 years ago

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.