vue add sass code example
Example 1: vue scss
npm install sass-loader node-sass style-loader --save-dev
Example 2: setup scss in vue
npm i node-sass sass-loader
// create the path: styles/main.scss in your src directory
–src
|––styles
|––main.scss
// add this to your vue.config.js file in the root directory
module.exports = {
css: {
loaderOptions: {
sass: {
prependData: `@import "@/styles/_variables.scss";`
}
}
}
};
Example 3: vue js sass
# /!\ if you work with [email protected], it seems [email protected] doesn't work
# So, in terminal:
yarn add node-sass [email protected]
Example 4: vue add sass
<style lang="sass">
</style>
Example 5: vue sass loader
<style lang="scss">
</style>