Skip to content

bug: Stencil 4.39.0 emits literal \f control chars in component CSS, causing <style> blocks to be discarded #6500

@genadis

Description

@genadis

Prerequisites

Stencil Version

4.39.0 (regression from 4.38.3)

Current Behavior

When a component stylesheet contains CSS escape sequences for control characters (for example, icon font declarations using content: "\f101";), the generated *.entry.js now embeds the stylesheet inside a template literal without re-escaping the backslash. This emits literal form-feed characters (ASCII 0x0C) into the <style> tag at runtime.
Browsers treat the control character as invalid CSS and discard the entire <style> block, so every rule in that stylesheet stops applying.

Expected Behavior

Escaped sequences inside component CSS should remain escaped in the emitted bundle (e.g., \f101 in the final string) so browsers parse the stylesheet normally, just as they did in 4.38.3.

System Info

System: node 22.16.0
Platform: darwin (24.6.0)
Build: 1765277402
Stencil: 4.39.0 🎭
TypeScript: 5.8.3
Rollup: 4.34.9
Parse5: 7.2.1
jQuery: 4.0.0-pre
Terser: 5.37.0
npm: 10.8.2
Browsers tested: Chrome 130

Steps to Reproduce

  1. Create a new Stencil component with styleUrl: 'test.css'.
  2. In test.css, add a rule that includes a Unicode escape, e.g.: .icon::before { content: "\f101"; }
  3. Build with Stencil 4.39.0 (npm run build).
  4. Inspect the generated bundle (e.g., dist/components/my-component.entry.js). The CSS string is now a template literal containing a literal form-feed character instead of the escaped \f101.
  5. Load the component in any browser; the <style> tag injected for the component is ignored entirely because of the control character.

Code Reproduction URL

https://github.com/genadis/stencil-css-escape-bug/blob/main/src/components/app-home/app-home.css#L10

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within StencilHas WorkaroundThis PR or Issue has a work around detailed within it.Help Wanted

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions