-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: added @parcel/css
support
#154
Conversation
Codecov Report
@@ Coverage Diff @@
## master #154 +/- ##
==========================================
+ Coverage 95.86% 95.88% +0.01%
==========================================
Files 3 3
Lines 266 267 +1
Branches 107 107
==========================================
+ Hits 255 256 +1
Misses 11 11
Continue to review full report at Codecov.
|
This is cool to see! Thanks for doing this.
Still deciding what to do about this. See parcel-bundler/lightningcss#39. Could you explain more about the other issues you ran into? Were there broken code samples I could look at? |
I tried to set
I run it on cssnano codebase and there a some cases, most around prefixes and normal writing, sorry, I don't have time to fully investigate it, try to adapt cssnano tests (quite possible there are cssnano bugs too), but they are mostly edge cases
I was wrong to use here
Can be collapsed in one string, good examples: a::before {
content: "This string is demarcated by double quotes.";
content: 'This string is demarcated by single quotes.';
content: "This is a string with \" an escaped double quote.";
content: "This string also has \22 an escaped double quote.";
content: 'This is a string with \' an escaped single quote.';
content: 'This string also has \27 an escaped single quote.';
content: "This is a string with \\ an escaped backslash.";
content: "This string also has \22an escaped double quote.";
content: "This string also has \22 an escaped double quote.";
content: "This string has a \Aline break in it.";
content: "A really long \
awesome string";
content: ";'@ /**/\"";
content: '\'"\\';
content: "a\
b";
content: "a\
b";
content: "a\
b";
content: "a\b";
content: "a\
\
\
\\
b";
content: 'a\62 c';
}
a[title="a not s\
o very long title"] {
color: red;
}
a[title="a not so very long title"] {
color: red;
} |
Thanks for the info! I see prefixes for Haven't handled the |
@devongovett Maybe something wrong between JS and Rust, because I tried the same and no prefixes, usage: new CssMinimizerPlugin({
minimizerOptions: {
targets: {
chrome: 4,
},
drafts: {
nesting: true,
},
},
minify: [CssMinimizerPlugin.parcelCssMinify],
}).apply(compiler); Example without plugin: const parcelCss = require("@parcel/css");
async function test() {
const parcelCssOptions = {
minify: true,
targets: { chrome: 4 },
drafts: { nesting: true },
sourceMap: true,
filename: "foo.css",
code: Buffer.from(".foo {border-radius: 24px;}"),
};
const result = await parcelCss.transform(parcelCssOptions);
console.log(result.code.toString());
// .foo{border-radius:24px}
}
test(); |
Ah, I see the issue. For performance, targets are represented using a 24 bit number to represent targets: {
chrome: 4 << 16
} |
@devongovett Yep, feel free to improve this, I think it is out of scope plugin, don't think we should do it here |
Yup, definitely. |
This PR contains a:
Motivation / Use-Case
fixes #153
Breaking Changes
No
Additional Info
*prop: value
)