parcel-bundler / parcel-bundler/lightningcss
Keep final semicolon in minified declaration blocks when targeting IE
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.7k
- Forks
- 302
- PR merge metrics
- No merged PRs in 30d
Description
IE (not necessarily Edge, but definitely IE) parses CSS some 2-3% faster if there's a final newline in a declaration block, e.g.
.some-class{some-prop:some-value;other:value;}
Is this possible today with existing configuration? From looking at the code, I don't think so, but I'm not 100% sure I'm looking for the right stuff.
If it's not currently supported, is this the right section of the code to modify to be sensitive to the browser target here? (Specifically the conditional if i!= len -1 bit.) Would we want an additional field in MinifyOptions to prefer performance over file size / network transfer speed?
macro_rules! write {
($decls: expr, $important: literal) => {
for decl in &$decls {
decl.to_css(dest, $important)?;
if i != len - 1 {
dest.write_char(';')?;
dest.whitespace()?;
}
i += 1;
}
};
}
Contributor guide
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
Start at the declaration-writing macro and its conditional if i != len - 1, then inspect MinifyOptions and the existing browser-target handling. Determine whether IE-specific output can be configured without changing other targets. Done means a supported configuration preserves the final semicolon for IE while retaining minification behavior elsewhere, with the relevant behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100