Search code examples
webpackwebpack-style-loader

How to configure WebPack only for SASS to CSS


I'm very noob with WebPack

I try to find the simplest configuration code for using it to tranform a sass file to a css file

Someone could give me a sample?


Solution

  • Get sass-loader

    Then add this in your config

      module: {
        loaders: [
          {
            test: /\.scss$/,
            loaders: ["style", "css", "sass"]
          }
        ]
      }
    

    After that you can require your scss files like this

    require("./styles.scss").