我想整理一套.scss
文件为不同的文件名。
在开发中,我想编译例如。foo.scss
to foo.dbg.css
(未缩小并带有评论)。在生产中,我想要例如。foo.min.css
(缩小)。
有没有办法告诉 SASS/Compass 使用什么作为目标扩展?命令行开关? Aconfig.rb
option?
编写一个首先编译然后重命名文件的脚本似乎是一个糟糕的选择,因为那样我就无法使用compass watch
有效率的。
(嗯,我could编译到两个不同的输出目录,然后编写一个从那里复制文件的脚本。感觉有点笨拙。)
UPDATE:我通过编写手表代码的简化版本解决了这个问题。当某些内容发生变化时,它会触发重新编译到两个不同的输出目录,然后重命名并将文件移动到适当的位置。
我无法让 Alireza Fattahi 的答案起作用,因为它引发了错误,所以我找到了另一个适合我的例子
http://h3r2on.com/2013/05/17/rename-css-on-compile.html http://h3r2on.com/2013/05/17/rename-css-on-compile.html
require "fileutils"
on_stylesheet_saved do |file|
if File.exists?(file)
filename = File.basename(file, File.extname(file))
File.rename(file, css_dir + "/" + filename + ".min" + File.extname(file))
end
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)