如何@import .css 文件作为 sass 中的 .scss 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42732832/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to @import .css file as a .scss file in sass?
提问by bobsilon
I am using gulp as a task runner which merge and minifying scss
files for me. In this case if I try to import a regular CSS
file, it will compile to a css import
statement as below:
我使用 gulp 作为任务运行器,它scss
为我合并和缩小文件。在这种情况下,如果我尝试导入常规CSS
文件,它将编译import
为如下css语句:
/* style.scss */
@import "../../bower_components/animate.css/animate.css";
/* style.css */
@import url(../../bower_components/animate.css/animate.css);
So how to import that regular css file, to have a compiledversion of that in the style.css
instead of just css @import
statement?
那么如何导入该常规 css 文件,以在而不是仅语句中获得该文件的编译版本?style.css
css @import
回答by bobsilon
Simply do this:
只需这样做:
/* style.scss */
@import "../../bower_components/animate.css/animate";
Just don't write file extension, Import the file without the extension, the compiler will put the file content in style.css
instead of putting @import
rule.
只是不要写文件扩展名,导入没有扩展名的文件,编译器会将文件内容放入style.css
而不是放入@import
规则。