Skip to main content

minify_js

Function minify_js 

Source
pub fn minify_js(js: &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 JavaScript by removing comments and collapsing whitespace.

ssg’s own implementation rather than a dependency. It is deliberately conservative: it does not rename, reorder or rewrite anything, so it cannot change what a script does. String literals, regex literals and the division operator are all left alone.