Build And Deploy

Generated Assets Before Build

Refresh generated CSS and JavaScript before Go embeds public files.

By Guillermo Alvarez - Published Updated

Understand the embed boundary

Go embeds files that already exist on disk when go build runs:

//go:embed views public
var Files embed.FS

Generated files under app/public must be current before building the production binary.

Refresh stylesheets

Run Tailwind after changing stylesheet source or package files:

lazy tailwind

The conventional output path is:

app/public/styles.css

Commit both the source stylesheet and the compiled public stylesheet.

Refresh JavaScript

Run the JavaScript pipeline after changing js.toml, package files, lockfiles, or files under app/js:

lazy js

Generated outputs include:

app/public/assets/importmap.json
app/public/assets/lazyshaft/

Those files are embedded in the binary and should be committed with matching source changes.

Build after generation

Build only after generated files are ready:

lazy tailwind
lazy js
go build -o .tmp/build/app ./cmd/app

During local development, lazy runs lazy js for apps with js.toml. Production builds should still run explicit generation commands in the build script.