Minify Files for Production

With the lila-minify command you can minify your js and css files located in the public/js and public/css folders.

Terminal Command

lila-minify

Asset Optimizer (lila-optimize)

For maximum Lighthouse scores and zero-CPU overhead in production, use the lila-optimize command.

Unlike lila-minify which overwrites files, lila-optimize acts as an Ahead-of-Time asset builder:

  • Images: Converts .png, .jpg, and .jpeg to .webp using Pillow (quality 80%).
  • CSS/JS: Generates parallel .min.css and .min.js files without destroying your original source code.
  • Manifest: Generates an app/assets_manifest.json dictionary.
Terminal Command

lila-optimize

Silent Magic (Templates)

When DEBUG=False, Lila automatically loads the manifest into RAM. The {{ '{{' }} public('img/logo.png') {{ '}}' }} Jinja helper performs a fast dictionary lookup. If a .webp or .min.js version exists in the manifest, it will automatically serve it instead of the original file, saving you from rewriting your HTML!

Modern Alternative: Unified Vite Asset Pipeline

If you are working in a modern frontend environment with Node.js and npm installed, Lila includes built-in support for a Vite + Tailwind CSS v4 pipeline which replaces the need for lila-minify or lila-optimize:

  • Zero-Config Dev: Simply run npm run dev to boot both the Vite dev server and the Python uvicorn server in parallel, providing full Hot Module Replacement (HMR) for CSS and JS assets in real-time.
  • Production Builds: Run npm run build to compile, bundle, and generate cached hashed files (e.g. utils-CnU24iax.js) via Vite's native manifest.json. Lila resolves these hashed files automatically in production.
  • Zero-Dependency Fallbacks: If Node.js is not present on a target system, Lila falls back seamlessly to static files in the public/ folder, ensuring your project always runs out-of-the-box.