[英]Compile 2 css files with Sass
I want to compile two .css files each time I save my style.sass file 我每次保存style.sass文件时都想编译两个.css文件
For example : 例如 :
style.dev.css for development with these options : 使用以下选项进行开发的style.dev.css:
sass_options = {:debug_info => true}
And style.css for production with these options : 和style.css用于生产的这些选项:
sass_options = {:debug_info => false}
output_style = :compressed
line_comments = false
The goal is to have a firesass ready css file on my local machine and the compressed version on svn. 我们的目标是在我的本地计算机上安装有firesass就绪的css文件,并在svn上具有压缩版本。 For the time being I have to edit config.rb each time I want to commit my change on svn. 暂时我每次想对svn进行更改时都必须编辑config.rb。
Is it possible ? 可能吗 ?
First of all, as bookcasey already mentioned, you should not store the compiled CSS in version control. 首先,正如书柜已经提到的那样,您不应将已编译的CSS存储在版本控制中。
To deploy your frontend, use git hooks: Automatically Recompile SASS upon Deployment Using Git Hooks . 要部署前端,请使用git hooks: 在部署时使用Git Hooks自动重新编译SASS 。
Second, the solution you suggested won't solve the nuisance of editing configuration each time. 其次,您建议的解决方案不会每次都解决编辑配置的麻烦。 It's just instead of editing the config.rb
, you'll have to edit your HTML to load the necessary CSS file. 只需编辑html即可加载必要的CSS文件,而不是编辑config.rb
。
But there's a handy workaround. 但是有一个方便的解决方法。
1) Modify your config.rb
to make use of the environment
flag: 1)修改您的config.rb
以使用environment
标志:
if environment == :development
sass_options = {:debug_info => false}
output_style = :compressed
line_comments = false
else
sass_options = {:debug_info => true}
end
2) Compile SASS with compass compile -e development
for development environment and vanilla compass compile
for production. 2)使用compass compile -e development
以开发环境,并使用香草compass compile
进行生产。
Yay! 好极了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.