Skip to main content
Every new website starts with a global_css source file containing @import "tailwindcss";. Tailwind CSS 4 is already installed and integrated into Cactal’s website compiler, so there is no package installation or JavaScript configuration. Keep the import for Tailwind utilities and preflight, or remove it to use plain CSS without Tailwind’s preflight.

Add global CSS

The global_css singleton contains raw site-wide CSS:
global_css
The framework compiles, optimizes, prefixes, and minifies this CSS during the website build, then embeds the result in the document <head>. Modern CSS nesting, custom properties, media queries, keyframes, and standard at-rules are supported. Upsert it like any other singleton:
Set global CSS
Global CSS is source-versioned. It reaches the draft after the preview build and reaches production only after publish.

Enable or disable Tailwind CSS

New sites are already enabled by the visible Tailwind import at the top of global_css:
global_css
Then use utilities directly in page and component TSX:
pages/home
The import is the only setup step. Remove that line to use plain CSS without Tailwind’s preflight. Without it, Tailwind-looking class names do not generate utilities, while ordinary authored CSS still builds normally.

Class discovery

At build time, Cactal scans the website’s TSX source, including pages, components, and the custom not-found page. It recognizes complete class candidates in source strings, including variants, arbitrary values, important modifiers, and negative utilities.
Do not construct partial class names dynamically:
Select complete literals instead:
Class candidates inside installed npm package source are not scanned. If a package emits class names at runtime, ensure every required complete class also appears in your website source or recreate the required styles in global_css.

Define a theme

Tailwind CSS 4 theme variables work directly in global_css:
global_css
Those variables generate utilities such as bg-brand-500, font-display, and animate-fade-in when the utilities appear in scanned source. You can combine Tailwind layers with ordinary selectors:

Use assets and fonts

Upload a font as a file asset. Begin the upload with the font’s canonical MIME type and exact byte size:
Begin the font upload
Use the returned upload.url, method, and headers to send the raw bytes, then finalize the returned asset id:
Upload and finalize
Finalize returns the stable CDN URL:
Use that ready asset URL in @font-face or url(...):
WOFF2, WOFF, TTF, OTF, and TTC files are supported. Font uploads declared as application/octet-stream or with a legacy font MIME alias are stored with their canonical font MIME type. Fetch the current ready URL with GET /v1/websiteAssets/{assetId}. See Upload assets for the full upload flow. Prefer absolute HTTPS or root-relative URLs. Because Cactal embeds site CSS in every page, a relative URL such as images/hero.png resolves relative to the requested page path and can break on nested routes.

Imports and plugins

@import "tailwindcss" is the only CSS import the compiler resolves. Local file imports, package CSS imports, and other import specifiers fail the framework quality gate. Remote stylesheet imports such as @import url("https://fonts.googleapis.com/css2?family=Fraunces") are not resolved at build time and do not fail the gate. Placed above @import "tailwindcss", they pass through to the compiled stylesheet and the browser loads them at runtime. Placed after it, they are silently removed from the compiled output because the Tailwind import expands into regular rules and CSS requires every @import to precede other rules. For web fonts, prefer preconnect and stylesheet <link> tags in custom_head_start (the browser discovers them earlier than a CSS import) or a self-hosted @font-face as shown above. See Customize site-wide files for the head injection points. Tailwind JavaScript configuration files and @plugin modules are not part of the website source model. Use CSS-first Tailwind configuration such as @theme, authored CSS, and keyframes in global_css.
Do not paste untrusted CSS. Global CSS can load remote resources, cover interactive content, or change the entire site’s behavior and appearance.

Build behavior

The website build:
  1. Scans website TSX source for Tailwind candidates.
  2. Compiles global_css, loading Tailwind only when requested.
  3. Generates utilities for discovered candidates.
  4. Optimizes, prefixes, and minifies the final stylesheet.
  5. Embeds the stylesheet before custom_head_end content.
Invalid CSS or an unsupported import fails head/check and publish. The previous published deployment remains live when a new build fails.

Troubleshooting

Next steps