Add a vue-cli Configure Sass-Resources-Loader Example
See original GitHub issueWhat problem does this feature solve?
I read the vue-cli docs about sass-resources-loader section and can not understand how to configure the vue-cli project for this. After some codes reading,I write these codes for that loader to work out:
//vue.config.js
var path = require('path');
module.exports = {
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.tap(options => {
var scssResourceLoader = {
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, 'src/assets/_variables.scss')
}
};
options.loaders.scss.push(scssResourceLoader);
return options;
});
}
}
I hope this will help others.
What does the proposed API look like?
…
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Working with CSS - Vue CLI
Vue CLI uses PostCSS internally. You can configure PostCSS via . postcssrc or any config source supported by postcss-load-config, and configure ...
Read more >[Solved]-Using sass-resources-loader with vue-cli v3.x-Vue.js
vue -cli@3.x uses webpack-chain to manage its webpack config. To add sass-resources-loader to the predefined webpack config. Add the following to the ...
Read more >Using sass-resources-loader with vue-cli v3.x - iTecNote
How to use sass-resources-loader with vue-cli@3.x to add global scss variables and mixins. Best Solution.
Read more >How to use SASS / SCSS with latest vue-cli starter project?
you install the necessary dependencies. npm install -D node-sass sass-loader. for global styles, simply import the file into main.js :.
Read more >Globally Load SASS into your Vue.js Applications
Vue -cli allows to modify its configuration by creating a vue.config.js file at the root of the project that exports an object with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@phoet or you just try this official parameters:
You can found more options here:
@vue/cli-service/lib/options.js