天天看點

css/style/sass-loader差別

css-loader——translates CSS into CommonJS

The css-loader interprets @import and url() like import/require() and will resolve them.

style-loader——creates style nodes from JS strings

Adds CSS to the DOM by injecting a <style> tag

sass-loader——compiles Sass to CSS, using Node Sass by default

Loads a Sass/SCSS file and compiles it to CSS.

Use the css-loader or the raw-loader to turn it into a JS module and the MiniCssExtractPlugin to extract it into a separate file.