Minification

Automatic HTML minification powered by Cloudflare's Rust-based minifier.

Enable minification

Minification is enabled by default. You can explicitly control it in tulip.toml:

[minify]
enabled = true

How it works

tulip uses the minify-html crate, Cloudflare's high-performance Rust minifier. When enabled, every HTML file in the output directory is minified after all other build steps have completed.

What gets minified

  • HTML — whitespace is collapsed, comments are removed, and redundant attributes are stripped
  • Inline CSS — CSS inside <style> tags is minified
  • Inline JS — JavaScript inside <script> tags is minified

Build order

Minification runs as the final step in the build pipeline:

  1. Templates are rendered
  2. Markdown content is processed
  3. Plugins run their hooks
  4. Tailwind CSS is generated (if enabled)
  5. HTML minification runs

Example

Before minification:

<div class="container">
    <h1>Hello World</h1>

    <!-- welcome message -->
    <p>Welcome to my site.</p>
</div>

After minification:

<div class=container><h1>Hello World</h1><p>Welcome to my site.</div>