Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force Rails to precompile SCSS stylesheets?

I'm trying to run a CRM gem that is clearly not ready for primetime. I'm trying to contribute back to the project by adding all of the things I'm finding that's wrong with the program.

But I am stuck on an asset precompile issue. I'm about a mile wide and an inch deep on the Asset Pipeline. I have run:

bundle exec rake assets:precompile

but when trying to bring the application up in a browser, the following error is written to the log file:

ActionView::Template::Error (print.css isn't precompiled):
    5:     %title Not Ready Yet CRM
    6:     == <!-- #{controller.controller_name} : #{controller.action_name} -->
    7:     = stylesheet_link_tag :application
    8:     = stylesheet_link_tag :print, :media => 'print'
    9:     %style= yield :styles
    10:
    11:     = javascript_include_tag :application

The actual file in the gem is NOT called "print.css". It's called "print.css.scss".

Where do I tell Rails to pick up these files in Asset precompilation? And if I do, will it just automatically know how to interpret SCSS files?

like image 785
AKWF Avatar asked Feb 19 '23 07:02

AKWF


1 Answers

Add it to config.assets.precompile in config/application.rb or config/environments/production.rb.

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( print.css )
like image 167
Robin Avatar answered Mar 05 '23 19:03

Robin