Keep @import at the end of CSS after SCSS compile

风格不统一 提交于 2019-12-01 20:13:21

You can't. Sass is smart enough to know that @import declarations must be at the beginning of the file so it rewrites it for you to be valid.

The @import CSS at-rule allows to import style rules from other style sheets. These rules must precede all other types of rules, except @charset rules; as it is not a nested statement, it cannot be used inside conditional group at-rules.

https://developer.mozilla.org/en-US/docs/Web/CSS/@import

If this is not acceptable, you'll need to use multiple link declarations (which are arguably better anyway for the user).

Are you using @import for any particular reason? There are performance impacts, and no major use case anymore.

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";
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!