VS Code extension
stay in the editor.
same CLI underneath.
right-click in the sidebar or hit the command palette — it’s still leano, just wired up for lazy people (complimentary). fully local. no server. no API keys.
npx --yes leano ./public --format webp --quality 80 --json
search leano-vscode if the store's being weird. linux, mac, windows — same as the CLI.
what it does
what you need
| Thing | Notes |
|---|---|
| VS Code (or compatible editor) | ^1.85 engines field — same as the extension’s package.json. |
| Node + npm | extension shells out to npx leano. Node ≥ 18, same as the CLI. |
| network (first run) | npx might download stuff once. npx --yes skips the annoying prompts. |
sidebar right-clicks
the CLI only eats directories, so a single image run uses a temp folder under the hood — then outputs get merged back next to your file.
| You click | Menu | What happens |
|---|---|---|
.jpg / .jpeg / .png | Optimize Image | temp folder with that one file → run CLI → merge into the parent directory. |
a folder | Optimize Folder | CLI runs on that path directly. boring. reliable. |
command palette
| Command | If you didn’t start from the sidebar |
|---|---|
| Optimize Image | opens an image picker. |
| Optimize Folder | opens a folder picker. |
| Leano: Optimize Images | folder picker — same as the folder flow. |
output folder & in-place
| leano.inPlace | CLI | Result |
|---|---|---|
| off (default) | (no flag) | you get a sibling <folder>-optimized directory. classic leano behaviour. |
| on | --in-place | swaps folder contents via temp dir, rolls back if anything blows up. for single-file runs, inPlace changes where merged outputs are read from afterward. |
everything hangs off leano.* in settings. one namespace, less chaos.
settings
| Setting | Default | What it does |
|---|---|---|
leano.quality | 80 | compression quality 1–100 (-q) |
leano.format | webp | webp | avif | both (-f) |
leano.maxWidth | — | optional max width in px (--max-width) |
leano.maxHeight | — | optional max height in px (--max-height) |
leano.lossless | false | lossless mode (--lossless) |
leano.inPlace | false | folders: actually replace contents safely; single file: where merged outputs get read from after the run |
under the hood
the extension basically spawns what you’d type yourself. options map from settings. it parses the last JSON object on stdout for the summary (the CLI prints the pretty table first, then JSON — yeah, it’s a little quirky).
npx --yes leano <path> --json [options…]
hacking on it
clone the repo, hit F5 (Run Extension), stare at breakpoints. you know the drill.
build
npm install npm run compile # emit out/ npm run watch # tsc --watch
ship a .vsix for local installs
npm install -g @vscode/vsce # once npm run compile vsce package # produces .vsix
install via Extensions → … → Install from VSIX…. publishing is normal vsce + marketplace token stuff — read the official publishing guide when you’re ready.
miss the terminal already?
same flags, same sharp pipeline — just without a GUI holding your hand. or go full CI if you’re allergic to both.
MIT license — same deal as the CLI.