vuejs import scss 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
–src
|––styles
|––main.scss
module.exports = {
css: {
loaderOptions: {
sass: {
prependData: `@import "@/styles/_variables.scss";`
}
}
}
};
Example 3: importing scss into vue component
<style lang="scss">
@import 'sass/app.scss';
html, body{
margin: 0px;
padding: 0px;
background-color: $secondary-color;
}
</style>
Example 4: vue sass loader
<style lang="scss">
</style>