New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Minify unicode-range
s
#1470
Comments
https://www.npmjs.com/package/characterset/ is the upstream dependency you want! |
@zachleat: Thanks! I moved a related issue to that repository by the way: bramstein/characterset#5 |
Thank you for teaching me about yet another CSS 'descriptor'. My first instinct is to say that the size improvements are likely going to be negligible, as the |
fwiw if you use the 1.x release it works fine in CJS (and I’ve used it for many years) |
We do some of that already with https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-unicode - the last example you mentioned with wildcards is already transformed 🙂 |
What should be improved?
unicode-range
s can be minified by mixing codepoints, wildcards and ranges.(https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range)
Describe the solution you would like
Simplify unicode ranges as much as possible.
E.g. (
ABCD 1234
):unicode-range: U+20,U+31,U+32,U+33,U+34,U+35,U+41,U+42,U+43,U+44;
Can be minified to:
unicode-range: U+20,U+31-35,U+41-44;
With a wildcard (e.g.
@ABCDEFGHIJKLMNO
):unicode-range: U+40,U+41,U+42,U+43,U+44,U+45,U+46,U+47,U+48,U+49,U+4A,U+4B,U+4C,U+4D,U+4E,U+4F
Can be minified to a range:
unicode-range: U+40-4F;
And even to a wildcard, shorter yet:
unicode-range: U+4?;
Possible alternatives
Well, just not minifying unicode ranges, but this leaves basically risk-free minification on the table.
Additional context
The Unicode Range Interchange library/tool from @zachleat can already minify those unicode ranges,
so that functionality could be reused:
https://www.zachleat.com/unicode-range-interchange/
Though it does not support wildcards, which can minify even further, when applicable.
Are you willing to work on this?
The text was updated successfully, but these errors were encountered: