With Webpack, is it possible to generate CSS only, excluding the output.js?

前端 未结 4 1003
春和景丽
春和景丽 2021-01-30 11:25

I\'m using Webpack with the extract-text-webpack-plugin.

In my project, I have some build scripts. One of the build scripts is supposed to bundle and minify CSS only. As

4条回答
  •  萌比男神i
    2021-01-30 11:32

    Unfortunately, that is currently not possible by design. webpack started as a JavaScript bundler which is capable of handling other "web modules", such as CSS and HTML. JavaScript is chosen as base language, because it can host all the other languages simply as strings. The extract-text-webpack-plugin is just extracting these strings as standalone file (thus the name).

    You're probably better off with PostCSS which provides various plugins to post-process CSS effectively.

提交回复
热议问题