[Vuejs]-Importing SASS variables into Vue component

-1๐Ÿ‘

โœ…

I use the same stack. I have variables.scss file with variables and bulma mixins and that variables.scss file is imported only in main.scss .
To make all variables and mixins available in all components without using @import in style section you should add loaderOptions section to vue.config.js file. Here is my vue.config.js file:

module.exports = {
  css: {
    loaderOptions: {
      scss: {
        prependData: '@import "~@/assets/scss/_variables.scss";'
      }
    }
  }
}

Leave a comment