Best practices for scss additionalData and @use #12549
Unanswered
shizhihuaxu
asked this question in
Q&A
Replies: 1 comment 1 reply
-
https://sass-lang.com/documentation/at-rules/use/#differences-from-import Basically, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As sass recommends using @use to import files, I would like to use this method to import scss files in my project. One problem I have encountered is that when a file is loaded in additionalData using @use for global use of scss variables, it is accessible if the scss variables are used directly within the style tag in the .vue file, but if the .vue file uses @use to reference a separate scss file that uses global scss variables, it will error out. file uses a global scss variable, it will report that it is not accessible, so using @import instead will work.
由于sass 推荐使用@use 导入文件,所以我希望项目中使用此方式导入scss 文件。我遇到的一个问题是,在 additionalData 中使用 @use 加载了某个文件以便全局使用scss变量,如果在 .vue 文件中的 style 标签内直接使用scss变量是可以访问到的,但是如果 .vue 文件使用@use引用了一个单独的 scss 文件,这个单独的 scss文件使用了全局scss变量,就会报错获取不到,改用@import 可以。
Beta Was this translation helpful? Give feedback.
All reactions