projectwallace / projectwallace/format-css

Generate a sourcemap

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
20
Forks
1
Avg merge
4m
Merged PRs (30d)
1

Description

I have a use case for tracking old and new string indexes of the before + after CSS (CSS Coverage inspector which needs to keep track which chunks of CSS are covered before/after prettification of the CSS).

This could also be done via a callback, like this, but sourcemaps are more elegant, I guess?

let positions = new Map<[number, number], [number,number]>
let new_css = fomat(old_css, { 
  on_node: function (node: csstree.CssNode, start_pos: number, end_pos: number }) {
    positions.set([node.loc.start.offset, node.loc.end.offset], [start_pos, end_pos])
  })
})

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

The issue names no files, tests, or entry points. Start by locating the TypeScript formatting pipeline and reviewing how source positions are represented. Done means exposing a sourcemap that relates old CSS string indexes or node ranges to their positions in the formatted CSS.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.