Code files (custom CSS and JS)

Write site-wide CSS and JavaScript files in a built-in code editor, organized in folders, with an AI coding assistant.

The Files tab of the builder holds the site's own code files. CSS files are compiled into the site stylesheet; JavaScript files run on an event you choose, such as page ready. Besides plain scripts you can create reusable functions, classes and modules that other code and dynamic bindings can call.

How it works

  • File types: css, js (Default: runs on an event), plugin (runs inside and outside the builder), class, module, function.
  • JS event: select from the website events list (default dh.ready); the file runs each time the event fires.
  • Plugin files run on load unless the URL has ?plugins=off.
  • Functions, classes and modules are registered by name and called with $dh.Fn(name, data), $dh.Class(name, ...args), $dh.Module(name); a 'Files > function' binding function calls a file function from dynamic values.
  • Folders: create, rename, delete, clone.
  • Editor: Monaco, Save button, Close, file rename and remove from the context menu.

When to use it

  • A custom CSS file for animations a class cannot express (@keyframes)
  • A JS file that initializes a third-party library on page ready
  • A reusable formatting function used in CMS bindings

Limitations

  • Files are site-wide; page-specific JS has to check the route itself.
  • CSS and JS changes go live at the next publish.

Availability

  • Works in Designer and MCP.
  • Included in every plan.
  • Limits: MCP: code up to 100,000 characters, names up to 70.

How to use it.

  1. Open the Files tab in the left sidebar.
  2. Create a CSS or JS file (for JS choose the type and event).
  3. Save and publish the site.

Questions.

When does my JS run?

Related features.

No card needed

Build it today.Pay when it goes live.

Every feature is unmetered while you build. Checkout opens the first time you publish.