vue import scss variables code example
Example 1: 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 2: importing scss into vue component
<style lang="scss">
@import 'sass/app.scss';
html, body{
margin: 0px;
padding: 0px;
background-color: $secondary-color;
}
</style>
Example 3: vue add sass
<!--
# Run this command in the root dir of your vue project:
npm i sass-loader node-sass style-loader
-->
<!-- And later in your vue component -->
<style lang="sass">
</style>