Skip to content

Commit

Permalink
[chore] replaces hard-coded minify values with vite.build.minify (#…
Browse files Browse the repository at this point in the history
…4803)

* [chore] replaces hard-coded `minify` values with `vite.build.minify`

* [style] changes ternary to not-equals

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* [chore] removes `minify` in favor of user config & Vite defaults

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
  • Loading branch information
Enteleform and bluwy committed Sep 20, 2022
1 parent 4d1b1b5 commit f53d97d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tender-nails-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

replaces hard-coded `minify` values with `vite.build.minify`
1 change: 0 additions & 1 deletion packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ async function clientBuild(
target: 'esnext',
...viteConfig.build,
emptyOutDir: false,
minify: 'esbuild',
outDir: fileURLToPath(out),
rollupOptions: {
...viteConfig.build?.rollupOptions,
Expand Down
3 changes: 2 additions & 1 deletion packages/astro/src/core/build/vite-plugin-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[]
if (output.type === 'asset') {
if (output.name?.endsWith('.css') && typeof output.source === 'string') {
const cssTarget = settings.config.vite.build?.cssTarget;
const minify = settings.config.vite.build?.minify !== false
const { code: minifiedCSS } = await esbuild.transform(output.source, {
loader: 'css',
minify: true,
minify,
...(cssTarget ? { target: cssTarget } : {}),
});
output.source = minifiedCSS;
Expand Down

0 comments on commit f53d97d

Please sign in to comment.