Sass,Compass,将所有CSS文件编译为一个 [英] Sass, Compass, compile all CSS file to one

查看:63
本文介绍了Sass,Compass,将所有CSS文件编译为一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,在开发项目时,我有三个文件,例如 main.css, about.css和 news.css。可以将它们编译成一个 final.css用于生产吗?

Now, while I am developing my project I have three files, "main.css", "about.css" and "news.css" (for example). Is it possible to compile them into one "final.css" for production?

推荐答案

SASS import指令用于将一个文件的内容导入另一个文件,因此您可以创建一个文件 final.scss ,其内容为:

The SASS import directive is used to import the contents of one file into another, so you could create a file final.scss whose contents are:

@import 'main';
@import 'about';
@import 'news';

然后您需要将文件重命名为具有 scss扩展名,以便导入指令可以找到他们。如果您不希望 main.scss about.scss 新闻。 scss 文件本身可以编译为CSS文件,则可以使用部分,在文件名前加上下划线(即 _main.scss _about.scss _news.scss )。

You'd then need to rename your files to have "scss" extensions so the import directive will find them. If you don't want the main.scss, about.scss, and news.scss files to compile to CSS files themselves, you can use partials by prefixing the filenames with an underscore (i.e., _main.scss, _about.scss, _news.scss).

这篇关于Sass,Compass,将所有CSS文件编译为一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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