webpack - using DefinePlugin for SCSS files

Viewed 327

I need to make my environment variables available to my [S]CSS files like it's done for the JS files using DefinePlugin. Something like this:

/** webpack.config.js **/
  ...
  plugins: [
    new webpack.DefinePlugin({
        IMAGES_FOLDER: JSON.stringify('img')
    })
  ]
/** index.scss **/
html {
    background: url(../IMAGES_FOLDER/bg.png) no-repeat center center fixed;
}

How can I accomplish this?

0 Answers
Related