projectwallace / projectwallace/format-css
Add option to generate type-per-line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 20
- Forks
- 1
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
For syntax highlighting purposes in a diff I want to know what sort of thing we're rendering in each line. So apart from returning the CSS as a string I also want an array if types:
import { format_with_types ] from '@projectwallace/format-css'
let { css, types } = format_with_types('a { color: red; }')
// => css
`a {
color: red;
}`
// => types
[
1, // selector
2, // declaration
3, // bracket
]
The following types are needed:
- selector (
a) - declaration (
color: red;) - bracket (
{,}) - atrule (
@media all)
This is sufficient for highlighting purposes because the formatting rules dictate that every atrule or selector prelude line end with a { and every declaration ends with a ;.
We don't need to support this for minified CSS because that's just madness.
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
The issue names no implementation files or tests. Start by reading the formatter API and the linked formatting rules, then trace how formatted lines are produced; done means non-minified output exposes the CSS and a matching per-line array of selector, declaration, bracket, or atrule types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100