> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cairnscript.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scripts

> JS and CSS scripts, edited side by side when they share a name.

A Cairn script is a single JS or CSS file. Give a JS and a CSS script the same base name (`hero.js` + `hero.css`) and Cairn opens them together in a paired editor: one screen, two panels. Each script in the pair keeps its own version history and publish state.

## Editor

The script editor splits the screen into JS and CSS panels. Both have:

* Syntax highlighting and autocomplete (CodeMirror).
* Format-on-save.
* A constrained vs. wide layout toggle (your preference is remembered per device).

## Versions

Every save writes a new `script_version` row. From the version history sidebar you can:

* Diff any two versions.
* Restore an earlier version (this creates a new version, so nothing is lost).
* See who shipped what, and when.

[Read about versions →](/essentials/versions)

## Publish flow

Saving creates a draft. Clicking **Publish** moves the draft to live, and the loader picks it up right away. Pending publishes show up in the editor footer so you always know what state a script is in.
