Guide / 08 β Assets
Assets & Tailwind CSS
Manage static files and modern CSS in a Go environment. Stew stays out of the way to keep your binary portable.
The /static Folder
The static/ folder at the root of your project is the central hub for all your assets (images, fonts, scripts). The Stew compiler also places generated Wasm binaries and the wasm_exec.js script here.
project/
βββ static/
β βββ images/
β β βββ logo.png β /static/images/logo.png
β βββ wasm/
β β βββ wasm_exec.js
β β βββ pages_page.wasm
β βββ style.css β /static/style.css
Tailwind CSS Integration
Since Stew uses .stew files, you must tell Tailwind to scan these files to extract utility classes.
// tailwind.config.js
module.exports = {
content: [
"./pages/**/*.stew", // Scan pages and layouts
"./components/**/*.stew", // Scan components
"./sdk/**/*.stew", // Scan SDK components (optional)
],
theme: {
extend: {},
},
plugins: [],
}
Pro Tip: Add the Tailwind build command (
tailwind -i ./src/input.css -o ./static/style.css --watch) to the commands: dev: scripts: section of your .stew.yaml to automate CSS compilation.
Performance & Cache
In production, we recommend adding middleware to set Cache-Control headers for your /static/ routes to ensure ultra-fast asset delivery.
π Optimization: If you use a CDN like Cloudflare, the files in
static/wasm/ will be cached, drastically reducing loading times for your users.