feat: css source map support
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- css, typescript
- Domain
- build-system, developer-experience
Research direction
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.
Written by the indexing model from the issue text.
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
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
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 870
- Avg merge
- 2d 54m
- Merged PRs (30d)
- 50
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stenciljs/core
-
bug: v5 dist/types/components.d.ts imports @stencil/core/runtime instead of ./stencil-public-runtimeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Stencil FOUC styles should use @layer to avoid cascade conflicts with React 19Possibly taken @johnjenkins claimed this 241 days ago. OpenStencil v5
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug: v5 streamed SSR host is released too early when a script inserts a node while it is parsedOpen
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
feat: write reflected attributes when the prop changes, not on the next renderPossibly taken @johnjenkins claimed this 241 days ago. OpenStencil v5
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
superlinked/sie#1033 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
remix-run/react-router#15838 ·
Maintainers usually reply within 1 day
-
area/ci bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
melgarafael/DeskcommCRM#5290 ·
Maintainers usually reply within 1 day