我们需要将 @import 放在我的 CSS 文件的末尾.例如:
We need to put @import at the end of my CSS file. For example:
SCSS:
@import "reset.css"; Body { font: 0.8em arial; } @import "customation.css"编译为:
@import "reset.css";body{font: 0.8em arial;}@import "customation.css"但编译后它改变了@import顺序,CSS文件将是这样的:
but after compile it changed the @import order and CSS file will be this:
@import "reset.css";@import "customation.css";body{font: 0.8em arial;}将@importing 文件放在custom.css 文件末尾对我们进行自定义非常重要.我们不能手动将 @import 放到 CSS 文件中,因为 SCSS 文件将被更改并且 CSS 文件将被重写.有什么建议吗?
It's very important for us to keep @importing the custom.css file at the end for our customization. We can't put the @import to CSS file manually because SCSS file will be changed and CSS file will be rewritten. Any suggestion?
推荐答案您是否出于任何特定原因使用 @import?有性能影响,并且不再有主要用例.
Are you using @import for any particular reason? There are performance impacts, and no major use case anymore.
如果你使用 Sass 的 @import 来连接文件会更好,这也允许你按照你想要的顺序导入并依赖级联.
It would be better if you used Sass's @import to concatenate the file instead, this would also allow you to import in the order you want and rely on the cascade.
@import "reset"; Body { font: 0.8em arial; } @import "customation";更多推荐
SCSS 编译后将 @import 保留在 CSS 的末尾
发布评论