A collection of packages that build a website using npm scripts.
autoprefixer, browser-sync, eslint, imagemin-cli, node-sass, onchange, npm-run-all, postcss-cli, svgo, svg-sprite-generator, uglify-js.
Many, many thanks go out to Keith Cirkel for his post and his useful CLI tools!
package.json file), start by running npm init. This will ask a few questions and use your responses to build a basic package.json file. Next, copy the "devDependencies" object into your package.json."devDependencies" into your package.json."scripts" object into your package.json "scripts" object.npm install to install all of the dependencies into your project.You're ready to go! Run any task by typing npm run task (where "task" is the name of the task in the "scripts" object). The most useful task for rapid development is watch. It will start a new server, open up a browser and watch for any SCSS or JS changes in the src directory; once it compiles those changes, the browser will automatically inject the changed file(s)!
cleanrm -f dist/{css/*,js/*,images/*}
Delete existing dist files
autoprefixerpostcss -u autoprefixer -r dist/css/*
Add vendor prefixes to your CSS automatically
scssnode-sass --output-style compressed -o dist/css src/scss
Compile Scss to CSS
linteslint src/js
"Lint" your JavaScript to enforce a uniform style and find errors
uglifymkdir -p dist/js && uglifyjs src/js/*.js -m -o dist/js/app.js && uglifyjs src/js/*.js -m -c -o dist/js/app.min.js
Uglify (minify) a production ready bundle of JavaScript
imageminimagemin src/images/* -o dist/images
Compress all types of images
iconssvgo -f src/images/icons && mkdir -p dist/images && svg-sprite-generate -d src/images/icons -o dist/images/icons.svg
Compress separate SVG files and combine them into one SVG "sprite"
servebrowser-sync start --server --files 'dist/css/*.css, dist/js/*.js, **/*.html, !node_modules/**/*.html'
Start a new server and watch for CSS & JS file changes in the dist folder
build:cssrun-s scss autoprefixer
Alias to run the scss and autoprefixer tasks. Compiles Scss to CSS & add vendor prefixes
build:jsrun-s lint concat uglify
Alias to run the lint, concat and uglify tasks. Lints JS, combines src JS files & uglifies the output
build:imagesrun-s imagemin icons
Alias to run the imagemin and icons tasks. Compresses images, generates an SVG sprite from a folder of separate SVGs
buildrun-s build:*
Alias to run all of the build commands
watch:cssonchange 'src/**/*.scss' -- run-s build:css
Watches for any .scss file in src to change, then runs the build:css task
watch:jsonchange 'src/**/*.js' -- run-s build:js
Watches for any .js file in src to change, then runs the build:js task
watch:imagesonchange 'src/images/**/*' -- run-s build:images
Watches for any images in src to change, then runs the build:images task
watchrun-p serve watch:*
Run the following tasks simultaneously: serve, watch:css, watch:js & watch:images. When a .scss or .js file changes in src or an image changes in src/images, the task will compile the changes to dist, and the server will be notified of the change. Any browser connected to the server will then inject the new file from dist
postinstallrun-s build watch
Runs watch after npm install is finished
Feel free to create an issue, tweet me, or send me an email. I'd be glad to help where I can!
—
$ claude mcp add npm-build-boilerplate \
-- python -m otcore.mcp_server <graph>