1

I have a custom application_admin.css.scss under app/assets/stylesheets

and I have this line in my config/environments/production.rb file

config.assets.precompile += [%w(application_admin.css)]

When I run bundle exec rake assets:precompile the custom stylesheet doesn't compile

I came across this post but I already have what they suggested. Rails Assets custom manifests are not precompiling

What else should I check?

Community
  • 1
  • 1

1 Answers1

2

First, you don't need to use both [] and the %w(). Try just:

config.assets.precompile += %w( application_admin.css )

which is the equivalent of:

config.assets.precompile += ['application_admin.css']

Second, since you are precompiling for your production environment you want to run:

RAILS_ENV=production bundle exec rake assets:precompile

Just:

bundle exec rake assets:precompile

runs it for your development environment by default. You will want to run this in each environment you want to precomplie your assests in.

Devin Stewart
  • 3,006
  • 1
  • 16
  • 22
  • no didn't do anything. "$ bundle exec rake assets:precompile $ " –  Aug 19 '13 at 01:00
  • @Newbie, Since you put it in your production.rb file you may want to do a: `RAILS_ENV=production bundle exec rake assets:precompile` – Devin Stewart Aug 19 '13 at 01:04
  • yes that worked! change the solution to including the environment and I will accept it. also do we run bundle exec rake assets:precompile for each environment separately? –  Aug 19 '13 at 01:12
  • Thank you! using [] wasn't a problem by the way, just an extra thing that I didn't need. It is specifically the environment that solved my problem. –  Aug 19 '13 at 01:27