默认情况下,SASS看起来暴露了scss文件,我发现这些文件相当令人讨厌。有没有办法配置SASS来查找不在Web根目录下但是将它们编译到public/stylesheets
文件夹中的文件夹中的scss文件?
答案 0 :(得分:1)
是!
如果您使用Compass,那么您将拥有一个文件/config/compass.rb,它将如下所示。这里我在app / stylesheets中有我的sass文件,并在tmp / stylesheets中编译保存(以帮助heroku部署)
<强> /config/compass.rb 强>
# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here.
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
#project_path = RAILS_ROOT if defined?(RAILS_ROOT)
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "tmp/stylesheets"
sass_dir = "app/stylesheets"
environment = Compass::AppIntegration::Rails.env
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
答案 1 :(得分:0)
老问题但实际上很简单,只需将目录传递给sass而不是特定的.scss,就像这样;
sass --watch / location / to / you / scss /:/ location / to / your / css
然后对scss的任何更改都将保存到您的css目录中,它也将遵循scss目录的相同结构。