Skip to content

Commit 45d52e8

Browse files
committed
Add docs for CLI
1 parent 2532a0f commit 45d52e8

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ A CSS parser, transformer, and minifier written in Rust.
4343

4444
## Documentation
4545

46-
`@parcel/css` can be used from [Parcel](https://parceljs.org), as a standalone library from JavaScript or Rust, or wrapped as a plugin within any other tool.
46+
`@parcel/css` can be used from [Parcel](https://parceljs.org), as a standalone library from JavaScript or Rust, using a standalone CLI, or wrapped as a plugin within any other tool.
4747

4848
### From Node
4949

@@ -148,6 +148,32 @@ console.log(new TextDecoder().decode(code));
148148

149149
css-minimizer-webpack-plugin has builtin support for `@parcel/css`. Install `@parcel/css` in your project, and configure the plugin as documented [here](https://github.com/webpack-contrib/css-minimizer-webpack-plugin#using-custom-minifier-parcelcss).
150150

151+
### From the CLI
152+
153+
Parcel CSS includes a standalone CLI that can be used to compile, minify, and bundle CSS files. It can be used when you only need to compile CSS, and don't need more advanced functionality from a larger build tool such as code splitting and support for other languages.
154+
155+
To use the CLI, install the `@parcel/css-cli` package with an npm compatible package manager:
156+
157+
```shell
158+
npm install @parcel/css-cli
159+
```
160+
161+
Then, you can run the `parcel-css` command via `npx`, `yarn`, or by setting up a script in your package.json.
162+
163+
```json
164+
{
165+
"scripts": {
166+
"build": "parcel-css --minify --nesting --bundle --targets '>= 0.25%' --sourcemap input.css -o output.css"
167+
}
168+
}
169+
```
170+
171+
To see all of the available options, use the `--help` argument:
172+
173+
```shell
174+
npx parcel-css --help
175+
```
176+
151177
## Benchmarks
152178

153179
<img width="666" alt="image" src="https://user-images.githubusercontent.com/19409/153888593-591a3c34-e401-4b30-94ac-7f8eb3c0b242.png#gh-light-mode-only">

0 commit comments

Comments
 (0)