Skip to content

Instantly share code, notes, and snippets.

@screamingjungle
Created March 22, 2017 16:39
Show Gist options
  • Save screamingjungle/c6f44dd5fa5477a00ffcfe77a9d5308b to your computer and use it in GitHub Desktop.
Save screamingjungle/c6f44dd5fa5477a00ffcfe77a9d5308b to your computer and use it in GitHub Desktop.
Using NPM as task runner
{
"name": "npm.task.runner",
"version": "0.0.1",
"description": "npm task runner",
"main": "index.html",
"author": "",
"license": "ISC",
"scripts": {
"clean": "rimraf dist/{css/*,js/*,img/*}",
"autoprefixer": "postcss -u autoprefixer -r dist/css/*",
"copy:css": "mkdirp dist/css -p && cp -r src/css dist","comment:copy:css": "todo: cssmin",
"copy:vendor": "mkdirp dist/vendor -p && cp -r src/vendor dist","comment:copy:vendor": "todo: copy min assets , optimise",
"copy:vendor-js": "mkdirp dist/js/plugins -p && cp -r src/js/plugins dist/js","comment:copy:vendor-js": "todo: optimise",
"copy:all": "npm run copy:css && npm run copy:vendor && npm run copy:vendor-js",
"scss": "node-sass --output-style compressed -o dist/css src/scss",
"htmlprocess": "htmlprocessor src/index.html -o dist/index.html","comment:htmlprocess": "todo: use more of this",
"lint": "eslint src/js || true",
"lint-scss": "stylelint src/scss/*.scss --syntax scss || true",
"uglify": "mkdirp dist/js -p && uglifyjs src/js/*.js -m -o dist/js/app.js && uglifyjs src/js/*.js -m -c -o dist/js/app.min.js || true",
"imagemin": "imagemin src/img/* -o dist/img",
"icons": "svgo -f src/img/icons -o dist/img/icons && svg-sprite-generate -d dist/img/icons -o dist/img/icons/sprite.svg",
"serve": "browser-sync start --server \"dist\" --files \"dist\"",
"build:html": "npm run htmlprocess",
"build:scss": "npm run lint-scss && npm run scss && npm run autoprefixer",
"build:css": "npm run copy:css",
"build:js": "npm run lint && npm run uglify",
"build:images": "npm run imagemin && npm run icons",
"build:vendor": "npm run copy:vendor",
"build:all": "npm run build:vendor && npm run build:css && npm run build:js && npm run build:images && npm run build:html",
"test": "jshint . --exclude node_modules",
"watch:css": "onchange \"src/scss\" -- npm run build:css",
"watch:html": "onchange \"src/**/*.html\" -- npm run build:html",
"watch:js": "onchange \"src/js\" -- npm run build:js",
"watch:images": "onchange \"src/img\" -- npm run build:images",
"watch:all": "npm-run-all -p serve watch:css watch:js watch:images",
"postinstall": "npm run build:all && npm run watch:all",
"prebuild": "echo I run before the build script",
"build": "npm run build:all",
"postbuild": "echo I run after the build script",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"autoprefixer": "latest",
"browser-sync": "latest",
"cssmin": "latest",
"eslint": "latest",
"eslint-config-standard": "latest",
"eslint-plugin-promise": "latest",
"eslint-plugin-standard": "latest",
"htmlprocessor": "latest",
"imagemin-cli": "latest",
"jshint": "latest",
"mkdirp": "latest",
"node-sass": "latest",
"npm-run-all": "latest",
"onchange": "latest",
"postcss-cli": "latest",
"rimraf": "latest",
"stylelint": "latest",
"svg-sprite-generator": "latest",
"svgo": "latest",
"uglify-js": "latest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment