CoordiationCSS
Menu
Docs/Tooling/Source maps

TOOLING · COMPLETE

Source maps

Trace production CSS back to the entry and every local CSS import, even after Coordiation generates layers, lowers nesting, adds prefixes, and minifies the result.

Coordiation emits standard Source Map v3 JSON. Authored rules retain CSS origins; generated framework layers map to the entry marker and recognizable theme or custom-definition segments retain their defining CSS source.

COMPOSED PIPELINE

One map follows every stage

The final consumer receives a single composed map instead of disconnected stage-specific files.

  1. 01

    Imports: associate bundled rules and definitions with the entry or resolved local CSS file.

  2. 02

    Framework: map authored CSS directly and generated layers to the closest framework definition or @coordiation marker.

  3. 03

    Transforms: extend mappings while nesting is lowered and target-specific prefixes are emitted.

  4. 04

    Optimization: preserve source identities and mappings in minified production output.

01

Enable maps in the production API

Supply a real entry filename. outputFilename controls the map's generated-file identity.

build.mjs
const result = await compileWithToolchain(inputCss, candidates, {
  filename: "/project/src/coordiation.css",
  outputFilename: "/project/dist/coordiation.css",
  sourceMap: true,
  toolchain: { minify: true },
});

await writeFile("dist/coordiation.css", result.css);
await writeFile("dist/coordiation.css.map", result.map);

result.map is a JSON string. result.toolchain.sourceMap is a compact machine-readable manifest of enabled state, source identities, and embedded-content policy.

02

Control embedded source text

Original CSS is embedded by default so DevTools can display sources without separately fetching project files.

Configuration
sourceMap: {
  sourcesContent: false,
}

Disable sourcesContent when source identities and line mappings are useful but original CSS must not be embedded in the artifact.

03

Choose external or inline CLI output

External maps are suitable for deployed debugging. Inline maps keep local or portable output self-contained.

External map
coordiation-css \
  -i src/coordiation.css \
  -o dist/coordiation.css \
  -c src \
  --sourcemap
Inline without source text
coordiation-css \
  -i src/coordiation.css \
  -o dist/coordiation.css \
  -c src \
  --sourcemap-inline \
  --no-sources-content

External mode writes coordiation.css.map and adds a relative annotation to the CSS. Watch mode refreshes the map before replacing the CSS output.

04

Return native Vite module maps

Enable sourceMap on the official adapter. The virtual CSS loader returns Vite's conventional { code, map } result.

vite.config.js
coordiation({
  content: ["src"],
  cssFile: "src/coordiation.css",
  sourceMap: true,
})
05

Compose with a PostCSS runner

When the runner requests a map, the adapter enables Coordiation mapping automatically and attaches it as the previous map for generated nodes.

postcss.process
const result = await postcss([coordiation({ content: ["src"] })]).process(css, {
  from: "src/app.css",
  to: "dist/app.css",
  map: { inline: false },
});

The adapter also publishes a coordiation-source-map result message for build diagnostics and agent inspection.

06

Inspect before describing coverage

result.toolchain.sourceMap
{
  enabled: true,
  sourcesContent: true,
  sources: [
    "project/src/coordiation.css",
    "project/src/theme.css",
    "project/src/components.css"
  ]
}

The source list describes CSS origins. Scanned HTML, JSX, Vue, or .coord templates are candidate-discovery inputs and are not presented as CSS source locations.

BOUNDARIES

Keep mappings useful and honest

Source maps explain generated CSS, not runtime DOM behavior.

  • Use literal local imports and a real filename so every source identity is stable.
  • Generated utilities without a CSS-first definition map to the @coordiation marker.
  • Template files are scanner dependencies, not CSS sources.
  • Do not expose embedded source text in public artifacts when project policy forbids it.
  • Read the actual manifest before claiming which imported files are mapped.

AI GENERATION CONTRACT

Generate the right delivery mode

Agents should match map output to the consumer rather than enabling an unused artifact.

  • Prefer Vite's returned map and PostCSS runner maps over writing duplicate files.
  • Use external CLI maps for deployed debugging and inline maps for self-contained local output.
  • Set sourcesContent: false when source text must not be embedded.
  • Preserve filename, outputFilename, and literal imports.
  • Never infer template-to-CSS mappings; only CSS origins are represented.