less-watch-compiler
raw JSON → 1.17.5 verified Fri May 01 auth: no javascript
A CLI tool that watches LESS file changes and automatically compiles them to CSS using the `lessc` compiler. Version 1.17.5 released intermittently; supports Node >=18. Key differentiator: it tracks dependency trees so changes to imported LESS files trigger recompilation of parent files. Filesystem watcher with options for source maps, plugins, and configuration files.
Common errors
error lessc: command not found ↓
cause LESS is not installed globally.
fix
Run
npm install -g less to install the lessc binary. Warnings
gotcha Requires global installation of `less` package to provide `lessc` binary. ↓
fix Run `npm install -g less` before using less-watch-compiler.
breaking Node >=18 required as of v1.17.0. ↓
fix Upgrade Node.js to version 18 or later.
deprecated The `lessc` binary may be deprecated in future LESS versions. The tool relies on `lessc` and may break if LESS changes its CLI. ↓
fix Monitor less-watch-compiler updates for compatibility changes.
gotcha Glob patterns in source/destination may not work as expected; only directories are watched. ↓
fix Use directories, not globs, for source and destination parameters.
Install
npm install less-watch-compiler yarn add less-watch-compiler pnpm add less-watch-compiler Imports
- CLI usage wrong
Installing globally without lessccorrectnpx less-watch-compiler src dist
Quickstart
# Install LESS and less-watch-compiler globally
npm install -g less less-watch-compiler
# Watch src folder and output to dist
less-watch-compiler src dist
# With main file (recompile only main.less on any change)
less-watch-compiler src dist main.less
# Using configuration file
less-watch-compiler --config less-watch-compiler.config.json
# Run once and exit
less-watch-compiler src dist --run-once