-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add @parcel/css to benchmark #101
Conversation
lib/minify.js
Outdated
@@ -37,6 +38,9 @@ const minifiers = { | |||
}, | |||
'esbuild': source => { | |||
return esbuild.transformSync(source, { loader: 'css', minify: true }).code; | |||
}, | |||
'@parcel/css': source => { | |||
return parcelCss.transform({filename: "", code: Buffer.from(source), minify: true}).code; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to get even smaller output, you can specify browser targets. This allows @parcel/css
to e.g. remove vendor prefixes that aren't needed. See here for an example. Maybe it could be a separate column for that similar to the "advanced" modes of the other tools if you want to keep it separate. However, unlike those advanced modes, removing prefixes is a safe transform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I copied from the example benchmark you have in the repository. I wanted the default entry in the benchmark to be similar to other tools as they don't have any browser-specific optimisation and thus I didn't know which browsers would be "reasonabe" to set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I definitely think it should be clearer from the benchmark results that many of the smallest sizes shown are using unsafe transforms though. Maybe something to work on separately.
Hi @XhmikosR, is there something I can help with to get this merged ? |
package.json
Outdated
@@ -31,6 +31,7 @@ | |||
"main": "lib/index.js", | |||
"dependencies": {}, | |||
"devDependencies": { | |||
"@parcel/css": "^1.0.0-alpha.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be updated to "@parcel/css": "^1.0.0",
now that it has been released
note: with 1.0.0 i got errors on some input files
|
Happy to include this assuming tests pass. |
the errors are caused by outdated css invalid css syntax to please IE7 eg. Maybe you could update the pool to only include modern sets @XhmikosR edit: report on parcel-css repo parcel-bundler/lightningcss#39 |
Not sure about it, it will need time which I don't have right now, plus the other minifiers work with it even if it's invalid per the specs. |
I updated to @parcel/css 1.0.0 Indeed two files are in error, I changed the code a bit to correctly display that those are in error (the |
Fixed the warnings from the build as well |
lib/minify.js
Outdated
@@ -37,6 +38,9 @@ const minifiers = { | |||
}, | |||
'esbuild': source => { | |||
return esbuild.transformSync(source, { loader: 'css', minify: true }).code; | |||
}, | |||
'@parcel/css': source => { | |||
return parcelCss.transform({ filename: '', code: require('buffer').Buffer.from(source), minify: true }).code; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the require at the top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
I'm not sure the |
It does but not too badly :
It just concatenates the "error" labels, but still excludes the minifier that has at least one error before it was printing something like |
We need this solution to be more robust, although I don't have a suggestion right now... I'll just remove the offending CSS files. |
Thanks! If you have time to look at any other issues or improve the error situation, feel free to CC me (I don't watch repositories 'cause I'd go totally crazy 😛) |
And BTW, @parcel/css is super fast, almost unbelievable! I need to try it out. |
Yes I'll have a look into this, I'm working on a postcss plugin for @parcel/css right now and I'll come back to this after. No worries, your mental health is more important than open source projects ;-) |
Hello,
I added @parcel/css as a benchmark.
It's an alpha but interestingly it's the fastest tool in every test.
Fixes #100