如何防止SASS合并通过@import包括的文件? [英] How to prevent SASS from merging files included via @import?

查看:308
本文介绍了如何防止SASS合并通过@import包括的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以防止SASS合并通过 @import 包含的文件?

Is it possible to prevent SASS from merging files included via @import?

对于开发,我想保留原始CSS的引用(在我从SASS编译的安装程序已经)。

For development, i would like to maintain the references of the original CSS (in my setup compiled from SASS already).

推荐答案

文档 @import 规则说


所有导入的SCSS和Sass文件将被合并到一个单独的CSS输出文件中。

All imported SCSS and Sass files will be merged together into a single CSS output file.

并且解释有一些情况下它会编译为CSS @import规则:

And explain that there is some circumstances under which it will compile to a CSS @import rule:


  • 如果文件的扩展名为 .css li>
  • 如果文件名以 http:// 开头。

  • 如果文件名是 url()

  • 如果 @import li>
  • If the file's extension is .css.
  • If the filename begins with http://.
  • If the filename is a url().
  • If the @import has any media queries.

以下规则会告诉SASS合并导入的文件:

The following rules will tell SASS to merge imported files:

@import "foo.scss";
@import "foo";

以下规则将告诉SASS不会合并导入的文件

@import "foo.css";
@import "foo" screen;
@import "http://foo.com/bar";
@import url(foo);

这篇关于如何防止SASS合并通过@import包括的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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