What it is
WebCrush CLI is a command-line tool for optimizing vanilla HTML, CSS, and JavaScript projects. Point it at a directory and it minifies everything -- HTML, CSS, JS -- while preserving your folder structure exactly. Other files pass through untouched. No configuration required.
# Install globally npm install -g web-crush-cli # Run in your project webcrush # Or specify directories webcrush --input ./src --output ./dist
Why it exists
When working on static sites, the gap between "code that works" and "code that's optimized for deployment" usually meant configuring Webpack or Vite. For a project that doesn't use a JavaScript framework or a module system, that felt like the wrong tool -- a lot of overhead for something conceptually simple.
The idea was straightforward: walk a directory, minify what can be minified, copy everything else. The resulting tool ended up being something I've used on multiple projects since. It's one of those utilities that's small in scope but fills a real gap in a specific kind of workflow.
What it does under the hood
The tool wraps established minification libraries -- html-minifier-terser for HTML, clean-css for CSS, terser for JavaScript -- and adds the directory-walking and file-routing logic around them.
The key design choices were:
- No configuration file. Every setting has a sensible default.
- Non-destructive by default. Output goes to a separate directory; your source files are never modified.
- Folder structure is preserved exactly. The output directory mirrors the input directory.
- Binary files, images, and anything the tool doesn't recognize get copied as-is.
I used AI-assisted development to build this, particularly for the Node.js file system logic and CLI argument parsing. The design decisions -- what the tool should and shouldn't do, what the defaults should be, how the CLI interface should feel -- were mine.
When to use it
If you're building a static site with plain HTML, CSS, and JavaScript and you want a build step that produces optimized output without adding a full bundler to your project, this fits well. It's especially useful before pushing to static hosting platforms like Netlify or Cloudflare Pages.
It's not the right tool if you're using ES modules, if your project has a complex dependency graph, or if you need tree-shaking or code splitting. That's what bundlers are for. WebCrush CLI is for the simpler case.