Use webpack to compile .scss files without js

Viewed 511

Is it possible to use webpack to compile a directory of scss files to a directory of css files?

I don't want to use the sass command line tool because it's part of an angular project and with the help of custom builders I can run the webpack script with only ng build

e.g.

- src
 - themes
  - theme-dark.scss
  - theme-light.scss

to

- dist
 - themes
  - theme-light.css
  - theme-dark.css

Hower I think this is currently not possible because webpack seems to need the scss imported in javascript and not in single files and writes the generated files to js and not css.

Is that what I want even possible with webpack or do I need another tool?

1 Answers

You can use Sass compiler to compile scss to css with a single command. Exactly the use-case you are looking for.

sass --watch src/themes:dist/themes

watch will compile on a file change (optional)

Related