[英]How to @import .css file as a .scss file in sass?
I am using gulp as a task runner which merge and minifying scss
files for me. 我正在使用gulp作为任务
scss
器,为我合并和缩小scss
文件。 In this case if I try to import a regular CSS
file, it will compile to a css import
statement as below: 在这种情况下,如果我尝试导入常规
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
语句?
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
规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.