由于在网上找了一遍没找到如果在sublime中将sass编译的css转换成为自己喜欢的风格,所以换了一种思路搜索到了答案,这里我将讲述如果更改。
首先sass总共有四种编译风格
(1) nested(嵌套缩进、默认风格)
#main p {color: #00ff00;width: 97%; }#main p .red {background-color: #ff0000;color: #000000; }#main p .blue {background-color: #2ebcff;color: #878787; }
(2) expanded(展开、无缩进)
#main p {color: #00ff00;width: 97%;
}
#main p .red {background-color: #ff0000;color: #000000;
}
#main p .blue {background-color: #2ebcff;color: #878787;
}
(3) compact(紧凑、单行)
#main p { color: #00ff00; width: 97%; }
#main p .red { background-color: #ff0000; color: #000000; }
#main p .blue { background-color: #2ebcff; color: #878787; }
(4) compressed(压缩、无空格和换行)
#main p{color:#00ff00;width:97%}#main p .red{background-color:#ff0000;color:#000000}
大家只需将sass里面的engine.rb文件找到,一般路径是这样的:
D:\Software\Ruby22\Ruby24-x64\lib\ruby\gems\2.4.0\gems\sass-3.5.6\lib\sass
然后找到如下代码:
DEFAULT_OPTIONS = {:style => :expanded,----->将此处改为自己想要的风格就可以了:load_paths => [],:cache => true,:cache_location => './.sass-cache',:syntax => :sass,:filesystem_importer => Sass::Importers::Filesystem}.freeze
然后再在sublime里面编译一次,看看是否可以了?
资料参考于☞https://zhidao.baidu.com/question/1244030470937877179.html