nsk-tools (Nunjucks Starter Kit tools) — CLI tools for gulp-nunjucks-starter-kit. Now a standalone tool and optional companion to the main starter kit — usable either alongside it or in any other project.
- No tool should depend on another — each should do its own job well.
- A chance to apply and deepen TypeScript knowledge by rewriting one of my own tools in it.
- imagemin and its family of plugins have a recurring history of security issues — moving this out into a separate, independent package reduces coupling with the core build system.
- Room for future functionality.
- Independence between tools.
The following packages are wrappers around system utilities:
imagemin-gifsicle(gifsicle) ·imagemin-jpegtran(libjpeg) ·imagemin-pngquant(pngquant) ·imagemin-webp(cwebp)
npm install --save-dev @galaxyrobot1x/nsk-toolsnpx @galaxyrobot1x/nsk-tools <command>Requirements: Node.js ≥ 22, npm ≥ 10. Supported platforms: macOS, Linux, Windows.
Full help for all commands:
npx nsk-toolsGenerates an .njk component and its accompanying files.
npx nsk-tools create component Headernpx nsk-tools create component Header FooterCreates the following structure in src/:
src/
└── views/
├── components/
│ └── Header/
│ ├── Header.njk
│ ├── Header.scss
│ └── Header.mjs
└── data/
└── Header.json
Adds the component's stylesheet import to _components_import.scss. No path or
extension needed — just the component name.
npx nsk-tools import style Headernpx nsk-tools import style Header FooterAdds a line like:
@use "../../views/components/Header/_Header.scss";Image optimization and conversion built on imagemin and its plugins.
npx nsk-tools imagemin -m jpeg --input=./src/assets/img --output=./build/assets/img| Option | Alias | Description |
|---|---|---|
--minify |
-m |
Format to optimize: gif, jpeg, png, svg, all |
--convert |
-c |
Convert to another format: webp (for jpg/png) |
--input |
-i |
Path to the source images directory |
--output |
-o |
Path to the output directory |
npx nsk-tools imagemin -m jpeg -c webp --input=./src/assets/img --output=./build/assets/imgArchives project files and directories into tgz, zip, or tar.
npx nsk-tools create archive -o zip -p <directory>
npx nsk-tools create archive -o tgz -p <directory>
npx nsk-tools create archive -o tar -p <directory>Converts SVG files to base64 — single file or batch.
npx nsk-tools base64Converter -m single -p ./src/assets/img/icon.svgnpx nsk-tools base64Converter -m all -p ./src/assets/imgFull help for any command:
npx nsk-tools <command> --helpMIT