Skip to content

Commit

Permalink
feat: added @parcel/css support (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Jan 18, 2022
1 parent f558512 commit 5e5fe51
Show file tree
Hide file tree
Showing 8 changed files with 578 additions and 11 deletions.
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ Possible options:
- CssMinimizerPlugin.cssoMinify
- CssMinimizerPlugin.cleanCssMinify
- CssMinimizerPlugin.esbuildMinify
- CssMinimizerPlugin.parcelCssMinify
- `async (data, inputMap, minimizerOptions) => {return {code: "a{color: red}", map: "...", warnings: [], errors: []}}`

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

```js
module.exports = {
devtool: "source-map",
// Uncomment if you need source maps
// devtool: "source-map",
optimization: {
minimize: true,
minimizer: [
Expand All @@ -505,7 +507,8 @@ module.exports = {

```js
module.exports = {
devtool: "source-map",
// Uncomment if you need source maps
// devtool: "source-map",
optimization: {
minimize: true,
minimizer: [
Expand All @@ -525,7 +528,8 @@ module.exports = {

```js
module.exports = {
devtool: "source-map",
// Uncomment if you need source maps
// devtool: "source-map",
optimization: {
minimize: true,
minimizer: [
Expand All @@ -537,6 +541,27 @@ module.exports = {
};
```

### Using custom minifier [@parcel/css](https://github.com/parcel-bundler/parcel-css)

**webpack.config.js**

```js
module.exports = {
// Uncomment if you need source maps
// devtool: "source-map",
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin({
minify: CssMinimizerPlugin.parcelCssMinify,
// Uncomment this line for options
// minimizerOptions: { targets: { ie: 11 }, drafts: { nesting: true } },
}),
],
},
};
```

## Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.
Expand Down
278 changes: 278 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
},
"esbuild": {
"optional": true
},
"@parcel/css": {
"optional": true
}
},
"dependencies": {
Expand All @@ -69,6 +72,7 @@
"@babel/preset-env": "^7.16.7",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@parcel/css": "^1.0.3",
"@types/clean-css": "^4.2.5",
"@types/csso": "^5.0.0",
"@types/serialize-javascript": "^5.0.2",
Expand Down
Loading

0 comments on commit 5e5fe51

Please sign in to comment.