parcel-bundler / parcel-bundler/lightningcss

Minification can benefit from using single quotation marks on strings

Open
#313 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: minification
Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

If the string contains double quotation marks and not single quotation marks, it’s more compact to use single quotation marks.

For example, if the source contains this:

content:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="red" d="…"/></svg>')

Lightning CSS will currently make it more verbose by using double quotes on the string:

content: url("data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"red\" d=\"…\"/></svg>")

(… the other approach that could be taken in this particular case would be to parse the URL and change the SVG to use single quotes, but that’s not a general technique!)

Contributor guide

Open the contributing guide

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 file, test, or entry point. Start by reproducing the CSS example in Lightning CSS and trace the minifier’s string-quoting decision. Done means output uses single quotes when that requires fewer escapes without changing semantics, with regression coverage for the shown case.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
performance, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.