Skip to content

Commit

Permalink
fix(css): respect minify option for chunk css
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 31, 2020
1 parent 79d7e66 commit 6a287a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,12 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
emptyChunks.add(chunk.fileName)
}
// minify
chunkCSS = await minifyCSS(chunkCSS, config.logger)
if (config.build.minify) {
chunkCSS = await minifyCSS(chunkCSS, config.logger)
}
// for each dynamic entry chunk, collect its css and inline it as JS
// strings.
if (chunk.isDynamicEntry && chunkCSS) {
if (chunk.isDynamicEntry) {
const placeholder = `__VITE_CSS__`
code =
`let ${placeholder} = document.createElement('style');` +
Expand Down

0 comments on commit 6a287a1

Please sign in to comment.