heroku rake assets:precompile failed. Invalid CSS.

Today i played with sass and compass in my current rails project. On my local machine everything works fine. But when i want to make an update to my heroku app i got the following error:

Running: rake assets:precompile
rake aborted!
Invalid CSS after " *": expected identifier, was "/"
(in /tmp/build_3tizuffxebjqm/app/assets/

the funny thing is, in my application.css.scss file was no line with a *, so wtf?
after some research i found out, that there is a problem with the sass compiler if you got nested comments. the following code in one of my *.css.sass files causes the error:

// needs latest Compass, add '@import "compass"' to your scss
background-color: rgb(169,3,41); // Old browsers
@include filter-gradient(#a90329, #6d0019, vertical); // IE6-9
@include background-image(linear-gradient(top, rgba(169,3,41,1) 0%,rgba(143,2,34,1) 44%,rgba(109,0,25,1) 100%));

after removing this code block everything works fine. so be carefull if you comment blocks of code that contains comments already.

Leave a Reply