feat: css source map support

Aperta
#6,964 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Elements2720 ci sta già lavorando.

Dal 20/10/2026.

  • #6969 di @Elements2720 — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
css, typescript

Direzione di ricerca

Start by tracing the existing sourceMap option through the build and development pipelines, then inspect how CSS is passed to plugins such as @stencil/sass and through the minifyCss option. The issue proposes extending the option and carrying maps into runtime style tags, including style modes, but names no files or tests. Done means CSS maps work in build and development and can be used by browser developer tools.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Feature: Want this? Upvote it!
Prerequisites
Describe the Feature Request

Add native support for generating CSS source maps during the build and development processes.
Currently, Stencil supports JavaScript/TypeScript source maps, but lacks built-in generation for CSS source maps. This makes it difficult to trace compiled styles back to their original source files within the browser's developer tools.

Describe the Use Case

When developing large-scale design systems with Stencil, styles are often written using complex Sass/PostCSS setups or split across multiple utility files.

CSS source maps will allow developers to inspect an element and see the exact source file, improving the developer experience.

In addition coverage for CSS can be generated and mapped back to the responsible file.

Describe Preferred Solution

the current sourceMap option could be extended:

type SourceMapOption = boolean | {
  css?: boolean,
  js?: boolean,
}

This option must then be pass to plugins like @stencil/sass.

The internal minifier (minifyCss option) must also chain the source map.


to avoid any source map reference comment in the code which could interfere with normal source maps the output component could be extended:

const myComponentCss = () => ``;

const MyComponent = class {};
MyComponent.style = myComponentCss();

MyComponent.sourceMap = 'path to source map or inline source map'; 

the runtime can then inject both the style and sourceMap to the style tag.

to also support style modes the souceMap property can also be an object matching the name of the currently mounted style

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Lingua principale
TypeScript
Stelle
13.2k
Fork
870
Merge medio
2g 54m
PR unite (30g)
50

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stenciljs/core

Tutte le issue di stenciljs/core

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.