Skip to content

Commit e8730d6

Browse files
committed
docs: add README for using squoosh
1 parent feadc5c commit e8730d6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/assets/images/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Optimizing Images with Squoosh
2+
3+
Squoosh is a fantastic [open-source](https://github.com/GoogleChromeLabs/squoosh) image compression tool by Google usable both as a [web app ](https://squoosh.app/) and as a [CLI tool](https://www.npmjs.com/package/@squoosh/cli). Although the CLI is no longer maintained, it still is useful for bulk compressing images (such as every year's new board members).
4+
5+
## Using the Squoosh CLI
6+
7+
> [!IMPORTANT]
8+
> The Squoosh CLI does not support Node versions 18 and above. **Node 16 is recommended (`nvm use 16`).**
9+
10+
For our directory structure (as of Aug. 2024):
11+
12+
```
13+
DUCI-website
14+
└─ src
15+
└─ assets
16+
└─ images
17+
├─ board
18+
│ ├─ current
19+
│ └─ alumni
20+
└─ merch
21+
├─ ...
22+
```
23+
24+
If you wanted to optimize all images within `current/`, you'd run (at the root):
25+
26+
```
27+
npx @squoosh/cli --mozjpeg '{quality:75}' \
28+
-d src/assets/images/output \
29+
src/assets/images/board/alumni
30+
```
31+
32+
Breaking it down:
33+
34+
1. `npx @squoosh/cli` — calls the Squoosh CLI
35+
2. `--mozjpeg` — a flag converting images to `mozjpeg`
36+
3. `'{quality:75}'` — options
37+
4. `-d src/assets/images/output` — creates a directory with the outputted images at the specified location
38+
5. `src/assets/images/board/alumni` — what file(s) to compress

0 commit comments

Comments
 (0)