A daemon wrapper for Prettier that dramatically reduces formatting time by running a background server, eliminating Node.js startup and module loading overhead. Current stable version is 1.2.0, with infrequent releases. Compared to alternatives like prettier_d, prettier_d_slim is minimal and stable, with a smaller footprint. It automatically picks a free port, stores credentials in ~/.prettier_d_slim, and supports per-directory Prettier versions via a nanolru cache. Ideal for editor save-time formatting where sub-150ms latency is desired.
npm install prettier_d_slimVerified import paths — ran on the pinned version, not inferred.
Demonstrates installation, basic stdin formatting, server control commands, and netcat usage for sub-50ms formatting.
Run a warm-up call (e.g., format a dummy file) before performance-critical workflows.
Do not manually delete ~/.prettier_d_slim while server is running. Use 'prettier_d_slim stop' to cleanly shutdown.
The cache is LRU with size 10. To force a fresh instance for a directory, use 'prettier_d_slim restart' or remove the cache by stopping the server.
Always use --stdin-filepath with a filename that matches the language (e.g., file.js, file.ts, file.css).
Run 'prettier_d_slim start' to start the server and create the file.
Run 'prettier_d_slim stop' to stop any existing server, then retry. If the port is occupied by another process, wait or manually kill the process.
Redirect a file: 'prettier_d_slim --stdin --stdin-filepath file.js < file.js' or use --text.
Install globally with 'npm install -g prettier_d_slim' or use npx: 'npx prettier_d_slim ...'