Skip to content

Commit da4d529

Browse files
authored
Added documentation related to the npx or command line usage (#379)
1 parent 0d2e128 commit da4d529

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ if the cost exceeds the limit.
1717
and understandable metric compared to the size in bytes.
1818
* Calculations include **all dependencies and polyfills**
1919
used in your JS.
20+
* **Flexible usage**: Install as a dev dependency with full configuration
21+
or use with npx for quick checks (requires plugin installation).
2022

2123
<p align="center">
2224
<img src="./img/example.png" alt="Size Limit CLI" width="738">
@@ -93,6 +95,34 @@ We are using [Statoscope] for this analysis.
9395

9496
## Usage
9597

98+
### Quick Start with npx
99+
100+
Size Limit can be used with npx for quick size checks, but requires the appropriate plugin to be installed first due to its plugin architecture:
101+
102+
1. Install the required plugin as a **dev dependency** (choose based on your needs):
103+
104+
```sh
105+
npm install --save-dev @size-limit/file # For simple file size checks
106+
# Or for other cases:
107+
# npm install --save-dev @size-limit/webpack # For webpack projects
108+
# npm install --save-dev @size-limit/esbuild # For faster checks
109+
```
110+
111+
2. Run size-limit with **npx**:
112+
113+
```sh
114+
npx size-limit --limit "10 kB" dist/bundle.js
115+
```
116+
117+
3. Run size-limit with **global** installation instead of npx:
118+
119+
```sh
120+
npm install --global @size-limit/cli
121+
size-limit --limit "10 kB" dist/bundle.js
122+
```
123+
124+
Note: This approach works best for quick checks. For long-term project maintenance and CI integration, we recommend the full installation methods described below.
125+
96126
### JS Applications
97127

98128
Suitable for applications that have their own bundler and send the JS bundle

0 commit comments

Comments
 (0)