Search code examples
ruby-on-railsherokusasscompass-sass

Error compiling CSS asset (Compass + Sass + Heroku)


I have a site running on Heroku using Compass with Saas an is working fine (compiling assets when pushing to Heroku seems to be fine).

I added a new folder inside assets to namespace other styling, like this

/app/assets/stylesheets/site/site1.css
/app/assets/stylesheets/site/site2.css
/app/assets/stylesheets/site/common/base.css.saas
/app/assets/stylesheets/site/site/site1.css.saas
/app/assets/stylesheets/site/site/site2.css.saas
...

The problem is when I visit a page that use site1.css styling I get the following error

Error compiling CSS asset
Sass::SyntaxError: File to import not found or unreadable: ../compass/css3/text-shadow.
Load path: /app
  (in /app/app/assets/stylesheets/site/common/base.css.sass)

  /app/app/assets/stylesheets/site/common/base.css.sass)

The line that the error refers is this

/app/assets/stylesheets/site/common/base.css.sass
@import "../compass/css3/text-shadow"

I tried both "../compass/css3/text-shadow" and "compass/css3/text-shadow". In both cases I got the same error.

Any idea how to solve this?


Solution

  • Solved.

    I needed to specify on production.rb file the additional files to compile

    config.assets.precompile +=
      Dir["#{Rails.root}/app/assets/stylesheets/site/site/*.*"].collect {|s| "site/" + File.basename(s).gsub(/.scss|.sass/, '') }
    

    Now is working fine.