leeoniya / leeoniya/dropcss

sourcemap support

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
2.1k
Forks
64
PR merge metrics
No merged PRs in 30d

Description

i've personally not needed it, but it could be a quality of life improvement.

probably via https://github.com/Rich-Harris/magic-string but not sure how useful it would be without also ingesting a prior sourcemap, so also https://github.com/Rich-Harris/sorcery.

performance is somewhat a concern since we now need to also store indices in the token list.

perhaps the better way to keep this optional and out of the core is to optionally return a list of indices alongside the token list with indications of which were removed and leave the actual work of doing the sourcemapping to an external wrapper instead of bloating the core.

dropcss({trackLocs: true})

{
  css: ...,
  locs: [
    655,  // index
    12,   // chars removed
    928, // index
    533, // chars removed
  ] 
}

or better yet? add the location index as arg to shouldDrop(sel, loc) and let the consumer/wrapper accumulate the deleted array. (still behind an option flag).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. First resolve whether support belongs in core or an external wrapper, and evaluate the proposed magic-string/sorcery approach against the optional index-tracking alternatives and performance concern. Done means a decided API and implementation scope for sourcemap support, with its optional behavior and performance tradeoffs specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
performance, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.