Skip to content

sourcemap support #8

@leeoniya

Description

@leeoniya

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions