feat: css source map support

Đang mở
#6,964 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Elements2720 đang làm issue này rồi.

Từ ngày 20/10/2026.

  • #6969 của @Elements2720 — đang mở

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
css, typescript

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
13.2k
Fork
870
Merge trung bình
2 ngày 54 phút
Pull request đã merge (30 ngày)
50

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stenciljs/core

Tất cả issue của stenciljs/core

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.