> For the complete documentation index, see [llms.txt](https://docs.nuclearplayer.com/nuclear/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nuclearplayer.com/nuclear/development/runtime-tailwind.md).

# Runtime Tailwind

How Nuclear makes Tailwind CSS for custom views at runtime

Plugins and MCP clients can add custom views to the player. These views use Tailwind classes. The player builds its CSS only from its own source files. Thus a class that only a custom view uses has no CSS in the player build.

As a solution, the player compiles Tailwind CSS at runtime, only for the open custom view. When a custom view opens, the player collects the classes in the page and compiles them with the Tailwind compiler. The page is monitored for new classes. When they're added to the page, the player compiles again. When the view closes, the player removes the CSS and stops the observer. When no custom view is open, Tailwind does not operate.

The compiler gets its configuration from `packages/tailwind-config/runtime.css`. This file contains only the parts of the player configuration that are safe to apply two times: the theme, the utilities, and the animations. It does not contain the base styles or the theme variables. If the runtime CSS contains them, they override the styles of the player. The file also puts the runtime utilities in the `components` layer. Thus the utilities of the player always have priority.

This technique allows custom views to use the active theme so they can stay visually consistent with the rest of the player.

The code is in `packages/player/src/views/ViewOutlet/`.
