Skip to content

Commit 665eb5c

Browse files
committed
add global-styles.scss and prepend _variables.scss in sassLoader for vue
1 parent 08ab70a commit 665eb5c

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

src/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import Vue from 'vue';
22
import App from './App.vue';
33
import router from './router';
44

5+
import './scss/global-styles.scss';
6+
57
Vue.config.productionTip = false;
68

79
new Vue({

src/scss/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// this global variables will also be available in every vue file

src/scss/global-styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "variables";

vue.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ const {
44

55
// vue.config.js
66
module.exports = {
7+
css: {
8+
loaderOptions: {
9+
sass: {
10+
prependData: `
11+
@import "@/scss/_variables.scss";
12+
`,
13+
},
14+
},
15+
},
16+
717
chainWebpack: (config) => {
818
patternlabVuePluginConfig(config);
919
}

0 commit comments

Comments
 (0)