Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sprockets sass partial erb extension

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

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

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

all is ok.

However if a sass partial is renamed from say _sharedpartial.css.sass to _sharedpartial.css.sass.erb then the same variable declaration is not recognised.

I am not sure if this is the right forum to report this behaviour or if it is a sass, rails or sprockets problem.

P.S. I know that the asset pipeline targets efficiency through pre-compiled assets, but I am trying to write a theeme controller that is capable of selecting the default colour/layout scheme for a site which will subsequently form the default pre-compiled css asset in production.

Best regards,

John Leake

like image 281
John Leake Avatar asked Nov 26 '22 03:11

John Leake


1 Answers

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

I had the same question and found out that the solution is by installing sass-rais-path.

This gets Rails to work SASS + ERB as expected.

like image 158
Alvaro Lourenço Avatar answered Dec 09 '22 21:12

Alvaro Lourenço