Sprockets sass partial erb extension

I noticed that with the latest versions of rails and sprockets (3.2.1 and 2.2.0) there is a problem when the erb file extension is added to the partial part of sass.

eg. if somestylefilename.css.sass is renamed to somestylefilename.css.sass.erb and the file contains a sass variable declaration that uses erb, vis: -

$ background-color: <% = '# fff'%>;

everything is good.

However, if sass partial is renamed from say_sharedpartial.css.sass to _sharedpartial.css.sass.erb, then the same variable declaration is not recognized.

I'm not sure if this is a suitable forum to report this behavior or a problem with sass, rails or sprockets.

PS I know that the asset pipeline is aimed at efficiency using precompiled assets, but I'm trying to write a theeme controller that is able to choose the default color / layout scheme for the site, which will subsequently form the default precompiled css resource in production.

Yours faithfully,

John Face

+4
ruby-on-rails sass sprockets erb
source share
2 answers

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.

0
source share

It sounds a bit ridiculous, but have you tried to remove the .erb extension?

Usually you do not need to use it, even if you use erb tags.

-one
source share

All Articles