I don’t understand what each of style-loader, css-loader, sass-loader, file-loader, and mini-css-extract-plugin do, or how they’re supposed to interact to get this css on the page 😐

Follow

@vy all the *-loaders allow doing require() calls to those types of files, which then get inlined into JS. mini-css-extract-plugin will strip it out of the js bundle and into a plain .css file

as for getting that bundle into your page, I'd expect either your bundler to do it, or having to add a normal stylesheet include to whatever path css-extract outputs

@f0x Okay, so if I want to be able to import a css file from a node module, and import my own scss file, and have it output a css file to one of webpack’s regular outputs (as module css isn’t an option in this case),

would I have to use style-loader, css-loader, sass-loader, and mini-css-extract-plugin, in that order?

@vy you would only need sass-loader and mini-css-extract-plugin, in that order

nowadays I use browserify though, with icssify, but still not entirely happy with postcss and it's plugins

Sign in to participate in the conversation
Pixietown

Small server part of the pixie.town infrastructure. Registration is closed.