Skip to content

Debugging

The debug flow is collected on a single page in the visible docs. This section covers only the runtime values you give directly via data-luis:

  • debug
  • map
  • performance
<link rel="stylesheet" href="./styles.luis" data-luis="debug">

data-luis valueWhat it enablesWhen to use
debugWarning logs, import diagnostics, and rule map publicationWhen you want to see what went wrong during compilation
mapSource map information linking back to .luis source in DevToolsWhen you want to see which source a rule came from while inspecting
performanceCompile, import, and observed timing logsWhen you want to understand which sources are slow

Multiple values can be given together:

<link rel="stylesheet" href="./styles.luis" data-luis="debug,map,performance">

debug brings diagnostic information produced during compilation to the console.

<link rel="stylesheet" href="./styles.luis" data-luis="debug">
  • compile warnings
  • .luis import diagnostics
  • observed event logs
  • window.__LentyStyleRuleMap
[LentyStyle][runtime][warn][RUN0013] [debug] inline data-luis style: missing semicolon after declaration (line 4, code: missing-semicolon).
[LentyStyle][runtime][info][RUN0014] [debug] Loaded imported .luis: https://example.com/styles/tokens.luis (from https://example.com/styles/app.luis)
[LentyStyle][runtime][info][RUN0015] [debug] Import diagnostics: https://example.com/styles/tokens.luis (from https://example.com/styles/app.luis; 248 chars; 1.42 ms; cache miss; parent: https://example.com/styles/app.luis)

When debug is on, a log line is emitted for each observed event:

[LentyStyle][runtime][info][RUN0021] [debug] Observed mutation: https://example.com/styles/app.luis (tokens: 4, affected: 2, active: 3)

The event field can be one of:

EventWhen it fires
upsertSource first loads and observed rules are placed
mutationA DOM mutation changes an observed rule match
mutation-noopA DOM mutation arrived but no match changed
media-changeA media query state changed and updated the rule list
media-noopA media query changed but the active rule set stayed the same
lazy-enterA rule entered the viewport via lazy observation

When debug or map is on, the runtime first emits a log line:

[LentyStyle][runtime][info][RUN0022] [debug] Debug rule map ready: window.__LentyStyleRuleMap["luis-style-1"]

The selector and line information for the compiled style tag then becomes accessible here:

const map = window.__LentyStyleRuleMap['luis-style-1']

This data is particularly useful for:

  • finding where the rule being inspected came from
  • doing line matching per selector
  • reading the generated CSS and .luis source side by side

map links the generated CSS back to the .luis source on the DevTools side.

<link rel="stylesheet" href="./styles.luis" data-luis="map">
  • source map information is appended to the end of the CSS
  • a sourceURL footer is added
  • the .luis source from which a rule came is visible in DevTools

This mode is especially useful when:

  • you inspect an element
  • you see the rule coming in the styles panel
  • you want the rule to link back directly to the .luis source

map can be enabled on its own:

<link rel="stylesheet" href="./styles.luis" data-luis="map">

But in most cases this combination is more useful:

<link rel="stylesheet" href="./styles.luis" data-luis="map,debug">

This way both the source match in DevTools and the warning/diagnostic stream in the console appear together.


performance makes the runtime produce timing logs for individual compile and observed updates.

<link rel="stylesheet" href="./styles.luis" data-luis="performance">

Example for a source compiled through a worker (all optional fields visible):

[LentyStyle][runtime][info][RUN0016] [performance] Compiled https://example.com/styles/app.luis in 1.50 ms (css: 428 chars) (mode: full) (execution: worker:warm) (timing: compile 1.12 ms, bootstrap 0.300 ms, transport 0.180 ms, features 0.050 ms, remap 0.070 ms, compose 0.050 ms, map 0.040 ms, apply 0.040 ms, total 1.50 ms) (blocks: 12/12 rendered, reused: 0; parser: 1/1 parsed, reused: 0)

Example for a source compiled on the main thread:

[LentyStyle][runtime][info][RUN0016] [performance] Compiled https://example.com/styles/app.luis in 1.10 ms (css: 428 chars) (mode: full) (execution: main) (timing: compile 1.10 ms, compose 0.000 ms, apply 0.100 ms, total 1.10 ms) (blocks: 12/12 rendered, reused: 0; parser: 1/1 parsed, reused: 0)

Execution values: worker:warm, worker:cold, worker (when no state is available), main. All timing fields except compile are optional and only appear when measured; sub-millisecond values use 3 decimal places.

The (blocks: ...) suffix is present whenever incremental metadata is available — including full-mode compiles where it reports how many blocks were reused:

[LentyStyle][runtime][info][RUN0016] [performance] Compiled https://example.com/styles/app.luis in 0.40 ms (css: 428 chars) (mode: incremental) (execution: worker:warm) (timing: compile 0.40 ms, total 0.40 ms) (blocks: 2/8 rendered, reused: 6; parser: 2/8 parsed, reused: 6)
[LentyStyle][runtime][info][RUN0017] [performance] Compiled https://example.com/styles/tokens.luis in 0.72 ms (css: 248 chars) (imported by: https://example.com/styles/app.luis; cache: miss; parent: https://example.com/styles/app.luis)
[LentyStyle][runtime][info][RUN0018] [performance] Compiled https://example.com/styles/app.luis [observed:mutation] in 0.33 ms (css: 96 chars) (observed: 3/8 active, changed: 2)

The [observed:{event}] field can be upsert, mutation, mutation-noop, media-change, media-noop, or lazy-enter.

  • when you want to see which source is compiling slowly
  • when checking whether worker actually makes a difference
  • when you want to understand how much the observed mutation load has grown

Most common combinations:

UsageWhat it provides
debugwarning and diagnostic stream
mapsource match in DevTools
performancetiming logs
debug,mapboth console diagnostics and inspect/debug
debug,performancewarnings + timing tracking
debug,map,performancefull debug flow
<link rel="stylesheet" href="./styles.luis" data-luis="debug,map,performance">

NeedValue to enable
I want to see warningsdebug
I want to see which .luis file a rule came frommap
I want to see where the slowness isperformance
I want to see everything togetherdebug,map,performance