diff --git a/README.md b/README.md index 7f7fafc..048d625 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ A comparison of CSS minification engines. * [clean-css](https://github.com/GoalSmashers/clean-css) * [cssnano](https://github.com/ben-eb/cssnano) * [csso](https://github.com/css/csso) +* [esbuild](https://github.com/evanw/esbuild) ### How can I see the results? diff --git a/docs/index.html b/docs/index.html index 3f6f207..0b3a9f4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -20,145 +20,160 @@
Date: Thu, 29 Jul 2021 16:26:02 GMT +Date: Thu, 29 Jul 2021 16:41:30 GMT CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz OS: Windows_NT x64 10.0.19043 Node.js: v14.17.3diff --git a/lib/minify.js b/lib/minify.js index 3768678..3a1cb59 100644 --- a/lib/minify.js +++ b/lib/minify.js @@ -6,6 +6,7 @@ const cssnano = require('cssnano'); const csso = require('csso'); const gzipSize = require('gzip-size'); const Q = require('q'); +const esbuild = require('esbuild'); // MINIFIERS const minifiers = { @@ -30,6 +31,9 @@ const minifiers = { }, 'csso (restructure off)': source => { return csso.minify(source, { restructure: false }).css; + }, + 'esbuild': source => { + return esbuild.transformSync(source, { loader: 'css', minify: true }).code; } }; diff --git a/package-lock.json b/package-lock.json index 288f17a..029648e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1356,6 +1356,12 @@ "is-symbol": "^1.0.2" } }, + "esbuild": { + "version": "0.12.16", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.16.tgz", + "integrity": "sha512-XqI9cXP2bmQ6MREIqrYBb13KfYFSERsV1+e5jSVWps8dNlLZK+hln7d0mznzDIpfISsg/AgQW0DW3kSInXWhrg==", + "dev": true + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", diff --git a/package.json b/package.json index 793f1d3..3eaee7a 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "cssnano": "^5.0.7", "cssnano-preset-advanced": "^5.1.3", "csso": "^4.2.0", + "esbuild": "^0.12.16", "gzip-size": "^6.0.0", "postcss": "^8.3.6", "q": "^1.5.1",