Rails erb preprocessing not running in development mode

For some reason, this first attempt at dynamic styling gives me Sass :: SyntaxError on the line below. It seems that erb is not being processed in advance.

/* app/assets/stylesheets/variables.css.scss.erb */ $headerHeight: <%= '15px' %>; 

In development mode. Any idea what might trigger this?

Here are my asset related configuration options in case this helps:

 # Application config.assets.enabled = true config.assets.initialize_on_precompile = true config.assets.version = '1.1' # Development config.assets.compress = false config.assets.debug = false 
0
ruby-on-rails sass ruby-on-rails-3 asset-pipeline erb
source share
2 answers

Scss needs quotes around the 15px part. Therefore, you will need to do this:

 $headerHeight: "<%= '15px' %>"; 
0
source share

This is a sass-rails error, as discussed here .

I had the same question , and it turned out that the solution was to install sass-rais-path .

This gives Rails to work with SASS + ERB, as expected. No need to use quotation marks.

0
source share

All Articles