We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
分别style-resources-loader 和 vue-cli-plugin-style-resources-loader (前提是已经安装过 sass sass-loader)
vue add style-resources-loader 或 yarn add style-resources-loader vue-cli-plugin-style-resources-loader -D
// vue.config.js const path = require("path"); function resolve(dir) { return path.join(__dirname, dir); } module.exports = { pluginOptions: { "style-resources-loader": { preProcessor: "scss", patterns: [ resolve('./src/styles/global.scss') // 声明scss全局变量的文件 ] } } };
按以上两个步骤,可以在任何.vue文件的style标签中正常使用全局变量,但如果.vue文件中的scss是用@import url('')这种方式导入就例外
.vue文件中: <style lang="scss"> // @import url('./index.scss'); 这种方式导入-index.scss中全局变量无法被解析 @import "./index.scss"; </style>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一、安装loader
二、在vue.config.js中配置
三、相关问题
The text was updated successfully, but these errors were encountered: