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文件,它将编译为css import语句,如下所示:
/* 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 compiled version of that in the style.css
instead of just css @import
statement?
那么如何导入那个普通的css文件,在style.css中有一个编译后的版本,而不仅仅是css @import语句?
1 个解决方案
#1
37
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规则。
#1
37
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规则。