Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

react 项目 目录结构如下


public 
    |-index.html
    |-theme.css

index.html 中引入了 theme.css
现在想在 webpack 打包的时候 自动压缩css 能实现吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
538 views
Welcome To Ask or Share your Answers For Others

1 Answer

要引入插件 optimize-css-assets-webpack-plugin
optimize-css-assets-webpack-plugin

一般来说不需要复杂的配置

const?OptimizeCssAssetsPlugin?= require('optimize-css-assets-webpack-plugin');

plugins: [
    new OptimizeCssAssetsPlugin()
]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...