Styling
OpenRun supports working with Classless CSS libraries and also with TailwindCSS and DaisyUI. To use this, add the directive
style=ace.style("daisyui")in the app definition. The fields in the ace.style structure are:
| Property | Optional | Type | Default | Notes |
|---|---|---|---|---|
| library | false | string | The library to use, url to classless library, “tailwindcss” or “daisyui” | |
| themes | true | string[] | [] | The daisyui themes to include |
| disable_watcher | true | bool | false | Whether to disable the tailwind watcher process startup in dev mode |
| light | true | string | emerald | The DaisyUI theme to use in light mode for Actions |
| dark | true | string | night | The DaisyUI theme to use in dark mode for Actions |
Theme names, custom_themes names, property names and values, and the routing.template_locations patterns are written into the generated tailwind config, so they cannot contain {, }, ;, @, quotes, a backslash or newlines.
Classless CSS
If the library property is a url, it should point to a publicly accessible style file. The style file is downloaded into the static/gen/css/style.css file and automatically included as part of the openrun_gen_import template. The download:
- refuses hosts resolving to loopback, private or link-local addresses (also when going through
HTTPS_PROXY, as described for JavaScript libraries) - follows at most five redirects (never from https to http)
- is capped at 128MB
For example,
style=ace.style("https://unpkg.com/mvp.css@1.14.0/mvp.css"),imports the MVP.css library. Since this is classless, no changes are required in the HTML templates.
TailwindCSS
To use TailwindCSS, in app settings, add
style=ace.style("tailwindcss")Tailwind CSS works by scanning the HTML files for class names, generating the corresponding styles and then writing them to a static CSS file. A watcher process is started when an app using Tailwind is loaded in dev mode. The output of the watcher is written to static/gen/css/style.css file. This file is automatically included as part of the openrun_gen_import template.
To ensure that the tailwind watcher is started, the tailwind CLI needs to be installed manually. The standalone CLI is the easiest option: no npm or node_modules setup is required. The npm packages (npm install -D tailwindcss @tailwindcss/cli daisyui, with the installed node_modules/.bin/tailwindcss path as the command) also work.
The OpenRun server config file has the following entries:
[system]
tailwindcss_command = "tailwindcss"
tailwind_version = 4
file_watcher_debounce_millis = 300| Setting | Default | Meaning |
|---|---|---|
tailwindcss_command | tailwindcss | The tailwindcss executable used to start the watcher: a name looked up in the PATH or a path. Arguments are not supported, OpenRun generates the watcher flags |
tailwind_version | 4 | The generated config format. 4 generates Tailwind 4/daisyUI 5 CSS-first config in style/input.css. 3 uses the legacy Tailwind 3/daisyUI 4 tailwind.config.js config format. Values below 3 are rejected |
file_watcher_debounce_millis | 300 | Prevents repeated reloads of the application files during dev mode. On a slower machine, this value might have to be increased, but setting it too high makes the reload slower |
If the standalone version is being used change to
[system]
tailwindcss_command = "/path/to/tailwindcss"DaisyUI
To use DaisyUI, in app settings, add
style=ace.style("daisyui", themes=["dark"])Change to the preferred theme. DaisyUI is a good option to use to get great default styling for components, with the full flexibility of Tailwind. OpenRun takes care of creating the config files. With tailwind_version = 4, OpenRun writes the daisyUI plugin and theme list into style/input.css using the daisyUI 5 @plugin syntax. Using the CDN version of DaisyUI or Tailwind is not recommended since that will cause the style files to be large.
The standalone tailwind CLI does not bundle daisyUI. When a tailwindcss_command is configured, OpenRun automatically downloads the prebundled daisyUI plugin (a single daisyui.js file, no node_modules required) into the app’s work directory and references it from the generated style/input.css. The download happens once and is cached across server restarts. The download location can be overridden (for example to an internal mirror) with:
[system]
daisyui_url = "https://internal.example.com/daisyui.js"If the download fails (for example, no network access), OpenRun falls back to the @plugin "daisyui" node_modules based reference, which requires npm install daisyui such that daisyui is resolvable from the app work directory.
If using Actions, DaisyUI styles are automatically included. The themes can be customized using the light and dark property. When the app defines no style, the Actions UI uses the built-in openrun-light and openrun-dark themes.
Custom Themes
With tailwind_version = 4, fully custom daisyUI themes can be defined with the custom_themes property: a dict of theme name to the theme’s CSS properties. Setting light/dark to a custom theme name makes it the default for that color scheme:
style=ace.style("daisyui",
light="mybrand-light",
dark="mybrand-dark",
custom_themes={
"mybrand-light": {
"color-scheme": "light",
"--color-base-100": "#ffffff",
"--color-primary": "#007700",
# ... other daisyUI theme variables
},
"mybrand-dark": {
"color-scheme": "dark",
"--color-base-100": "#17221a",
"--color-primary": "#00c200",
},
})- OpenRun generates a daisyUI theme plugin block per custom theme in
style/input.css, using the prebundled daisyUI theme plugin, downloaded automatically like the main plugin.daisyui_theme_urloverrides the download location. - Custom themes can be mixed with the bundled theme names in
themes. - When only custom themes are used, the bundled themes are disabled, keeping the generated CSS small.