我想保存一个SASS文件,并输出两个不同设置的文件,"output_style“和”环境“。
我试验过两种方法:
我可以在Grunt中做到这一点,但我认为让CodeKit工作会很好。
其他选择?
发布于 2016-01-26 13:44:58
步骤1:开发配置config.rb应该如下所示:
# Basic configuration.
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line).
# Options: ":expanded", ":nested", ":compact", ":compressed"
output_style = :expanded
# Enable debugging comments that display the original location of your selectors.
line_comments = true
# Re-compile the sass files using the minified configuration.
on_stylesheet_saved do
`compass compile -c config_minified.rb --force`
end步骤2:您必须添加另一个配置文件config_minified.rb,它应该如下所示:
# Basic configuration.
http_path = "/"
css_dir = "css/minified"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
# Compressed the output for production.
output_style = :compressed
# Disable debugging comments for production.
line_comments = false步骤3:像往常一样编译,您已经准备好了:
compass watch/css/minified/style.css将自动生成。
遵循这些步骤之后,项目应该如下所示:
/css
/css/style.css
/css/minified/style.css
/images
/sass
/sass/style.scss
config.rb
config_minified.rb编辑
如果不想弄乱每个项目的相对路径,可以修改config_minified.rb,以便使用相对于根文件夹的css文件夹。
# do not use the css_dir = "css/minified" because it will break the images.
css_dir = "css-minified"https://stackoverflow.com/questions/21009134
复制相似问题