簡體   English   中英

編譯CSS資產時出錯(指南針+ Sass + Heroku)

[英]Error compiling CSS asset (Compass + Sass + Heroku)

我有一個在Sas上使用Compass的Heroku運行站點,但工作正常(推送到Heroku時編譯資產似乎很好)。

我在資產內向名稱空間其他樣式添加了一個新文件夾,如下所示

/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
...

問題是,當我訪問使用site1.css樣式的頁面時,出現以下錯誤

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)

錯誤指的行是這個

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

我嘗試了"../compass/css3/text-shadow""compass/css3/text-shadow" 在兩種情況下,我都遇到相同的錯誤。

任何想法如何解決這個問題?

解決了。

我需要在production.rb文件上指定要編譯的其他文件

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

現在工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM