Skip to content

feat(css): add build.cssMinify - #12207

Merged
patak-cat merged 1 commit into
mainfrom
feat-css-minify
Mar 8, 2023
Merged

patak-cat merged 1 commit into
mainfrom
feat-css-minify

Conversation

@bluwy

@bluwy bluwy commented Feb 26, 2023

Copy link
Copy Markdown
Member

Description

close #5619

Support build.cssMinify to configure CSS minification specifically. Fallback to build.minify if value is non-null.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy added feat: css p3-significant High priority enhancement (priority) labels Feb 26, 2023
@patak-cat
patak-cat merged commit 90431f2 into main Mar 8, 2023
@patak-cat
patak-cat deleted the feat-css-minify branch March 8, 2023 17:07
@fi3ework fi3ework mentioned this pull request Mar 8, 2023
5 of 9 tasks
elliott-with-the-longest-name-on-github pushed a commit to sveltejs/kit that referenced this pull request Nov 17, 2026
Related to #17794

`plugin_compile` sets `build.cssMinify` from `build.minify`, so a
`build.cssMinify` set in the user's Vite config is ignored. #9382 added
this as a workaround until Vite shipped a separate CSS minify option
(vitejs/vite#12207); that option is `build.cssMinify` and it now exists.

This uses `build.cssMinify` when the user sets it and keeps the existing
`minify`-derived value otherwise, so default behaviour is unchanged.
Server and client CSS still get matching hashes (the reason for #9382).
`build.cssMinify` isn't in `enforced_config`, so Kit doesn't currently
warn that it overrides it.

Without this, `build.cssMinify: 'esbuild'` is ignored and Vite 8 falls
back to Lightning CSS, which fails on CSS it can't parse (reproduction
in the linked issue).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: css p3-significant High priority enhancement (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable CSS minification (independently of JS)

2 participants