Skip to content

Commit 5e5fe51

Browse files
feat: added @parcel/css support (#154)
1 parent f558512 commit 5e5fe51

File tree

8 files changed

+578
-11
lines changed

8 files changed

+578
-11
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ Possible options:
224224
- CssMinimizerPlugin.cssoMinify
225225
- CssMinimizerPlugin.cleanCssMinify
226226
- CssMinimizerPlugin.esbuildMinify
227+
- CssMinimizerPlugin.parcelCssMinify
227228
- `async (data, inputMap, minimizerOptions) => {return {code: "a{color: red}", map: "...", warnings: [], errors: []}}`
228229

229230
> ⚠️ **Always use `require` inside `minify` function when `parallel` option enabled**.
@@ -485,7 +486,8 @@ module.exports = {
485486

486487
```js
487488
module.exports = {
488-
devtool: "source-map",
489+
// Uncomment if you need source maps
490+
// devtool: "source-map",
489491
optimization: {
490492
minimize: true,
491493
minimizer: [
@@ -505,7 +507,8 @@ module.exports = {
505507

506508
```js
507509
module.exports = {
508-
devtool: "source-map",
510+
// Uncomment if you need source maps
511+
// devtool: "source-map",
509512
optimization: {
510513
minimize: true,
511514
minimizer: [
@@ -525,7 +528,8 @@ module.exports = {
525528

526529
```js
527530
module.exports = {
528-
devtool: "source-map",
531+
// Uncomment if you need source maps
532+
// devtool: "source-map",
529533
optimization: {
530534
minimize: true,
531535
minimizer: [
@@ -537,6 +541,27 @@ module.exports = {
537541
};
538542
```
539543

544+
### Using custom minifier [@parcel/css](https://github.com/parcel-bundler/parcel-css)
545+
546+
**webpack.config.js**
547+
548+
```js
549+
module.exports = {
550+
// Uncomment if you need source maps
551+
// devtool: "source-map",
552+
optimization: {
553+
minimize: true,
554+
minimizer: [
555+
new CssMinimizerPlugin({
556+
minify: CssMinimizerPlugin.parcelCssMinify,
557+
// Uncomment this line for options
558+
// minimizerOptions: { targets: { ie: 11 }, drafts: { nesting: true } },
559+
}),
560+
],
561+
},
562+
};
563+
```
564+
540565
## Contributing
541566

542567
Please take a moment to read our contributing guidelines if you haven't yet done so.

package-lock.json

Lines changed: 278 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
},
5454
"esbuild": {
5555
"optional": true
56+
},
57+
"@parcel/css": {
58+
"optional": true
5659
}
5760
},
5861
"dependencies": {
@@ -69,6 +72,7 @@
6972
"@babel/preset-env": "^7.16.7",
7073
"@commitlint/cli": "^15.0.0",
7174
"@commitlint/config-conventional": "^15.0.0",
75+
"@parcel/css": "^1.0.3",
7276
"@types/clean-css": "^4.2.5",
7377
"@types/csso": "^5.0.0",
7478
"@types/serialize-javascript": "^5.0.2",

0 commit comments

Comments
 (0)