Turbo CSS code can be compiled both on the server and on the client.

While the Go implementation only supports server-side compilation, the JavaScript implementation can be used both on the server and in the browser (client). This is particularly useful for prototyping and playing with the language.


Turbo CSS supports build-time and run-time compilation.

You have two primary integration options: build-time and run-time compilation.

Using build-time compilation, you will have a step in your build process doing the following:

  • parse code-base to find Turbo CSS code (class names),

  • compile the code snippets found,

  • rewrite if necessary to apply namespacing (optional!),

  • generate resulting CSS file.

One benefit of this approach is that you can have the Turbo CSS compiler throw errors for incorrect code.

Using run-time compilation, you can either have a post-processing step similar to the above, that is processing the response before returning it, or you can follow these steps:

  • create Turbo CSS compiler instance upon starting to process the request,

  • pass around that compiler instances,

  • dynamically call the compiler and insert the returned (optionally namespaced) code into HTML class names,

  • finally, format the resulting CSS stylesheet and embed into the response.