Skip to main content

minify_css

Function minify_css 

Source
pub fn minify_css(css: &str) -> String
Expand description

ssg’s own CSS and JavaScript minifiers, re-exported so the whole minification surface lives behind one module.

These replace lightningcss and oxc_minifier, which sat behind an optional minify feature. A minifier rewrites every byte the generator emits; keeping it in-tree means it is covered by this crate’s own tests and cannot change underneath a release. Minifies CSS by collapsing insignificant whitespace and dropping comments.

ssg’s own implementation rather than a dependency: minification rewrites every stylesheet the generator emits, so a bug here is a bug on every page, and a parser that “improves” a selector can silently change what it matches. This pass only removes what cannot matter - it never rewrites a selector, a value or a string.