使用多个SASS文件 [英] Use multiple SASS files

查看:172
本文介绍了使用多个SASS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把我的(巨型)全局css文件分成多个文件。我使用sass。有一个简单的方法来获得sass观看多个文件?我想我可以使用@import,但只是想知道是否有另一种(更好的)方式。



提前感谢。

提示是正确的,但这里是你可以采取的另一种方法。

>

创建一个名为 combined.scss (例如)的scss文件, code> @import 所有的scss文件,然后运行 sass --style compressed --watch combined.scss:combined.css 并会根据需要检测导入的scss文件的更改并重新编译。



Combined.scss 示例: p>

  @importreset; 
@importlayout;
@importstyles;
@importie;

因此,当您更改 layout.scss file combined.scss 将重新编译,所有实际的html页面需要引用 combined.css



但是像我说的, Rich Bradshaw 的解决方案也可以正常工作,根据您正在开发的项目可能会更好使用。


I want to separate my (giant) global css file into multiple files. I'm using sass. Is there an easy way to get sass to watch multiple files? I think I could use @import, but just wanted to know if there was another (better) way.

Thanks in advance.

解决方案

What Rich Bradshaw mentions is correct, however here is another approach that you could take.

Create 1 scss file called combined.scss (for example) then inside of this file @import all your scss files, then simply run sass --style compressed --watch combined.scss:combined.css and it will detect changes to the imported scss files and recompile as needed.

Combined.scss example:

@import "reset";
@import "layout";
@import "styles";
@import "ie";

So when you make a change to the layout.scss file combined.scss will recompile and all your actual html pages will need to reference is combined.css.

But like I said, Rich Bradshaw's solution will work just as well and depending on the project you're working on might be better to use.

这篇关于使用多个SASS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆