Tina Gordienko_Drog
Tina Gordienko_Drog

Reputation: 335

How to include appropriate SCSS file?

I'm using Vue and I have multiple stylesheets for different configuration. And I need to use only one of them (depending on the configuration).

I have config file with value type: "a", so that I need to include and use "a-setup.scss". I tried to include file in vue.config.js, but it doesn't support imports.

So the question is: what should I do to use certain scss file?

Upvotes: 0

Views: 42

Answers (1)

Tina Gordienko_Drog
Tina Gordienko_Drog

Reputation: 335

So, the solution I found is to use css additionalData prop inside the vue.config.js. Code:

const filename = process.env.VUE_APP_TEMPLATE;

const additionalData =
  ... +
  `@import "src/assets/styles/setup/${ filename }.scss";`;

module.exports = {
  css: {
    loaderOptions: {
      sass: { additionalData }
    }
  },
  ...
 }

Upvotes: 0

Related Questions