Skip to content

Instantly share code, notes, and snippets.

Last active February 25, 2022 23:44
Show Gist options
  • Save hashrock/dce1a25729ac03945106 to your computer and use it in GitHub Desktop.
Save hashrock/dce1a25729ac03945106 to your computer and use it in GitHub Desktop.
    "build-js": "browserify browser/main.js | uglifyjs -mc > static/bundle.js",
    "build-css": "cat static/pages/*.css tabs/*/*.css",
    "build": "npm run build-js && npm run build-css",
    "watch-js": "watchify browser/main.js -o static/bundle.js -dv",
    "watch-css": "catw static/pages/*.css tabs/*/*.css -o static/bundle.css -v",
    "watch": "npm run watch-js & npm run watch-css",
    "start": "node server.js",
    "test": "tap test/*.js"
    "start": "npm run start-serve & npm run watch",
    "test": "stylestats public/files/css/maple.css",
    "start-serve": "browser-sync start --server public/ --files public/files/**/*",
    "clean": "rm -rf public/files/css/*",
    "js:min": "uglifyjs public/files/js/app.js > public/files/js/app.min.js",
    "build:js": "browserify assets/scripts/app.js > public/files/js/app.js",
    "css:sass": "node-sass assets/styles/maple.scss public/files/css/maple.css",
    "css:prefix": "autoprefixer -b 'last 2 versions' public/files/css/maple.css",
    "css:comb": "csscomb public/files/css/maple.css",
    "css:min": "csso public/files/css/maple.css public/files/css/maple.min.css",
    "build:css": "bin/",
    "build": "npm run build:js && npm run build:css",
    "lint:js": "jshint assets/scripts/app.js",
    "lint:css": "scss-lint assets/styles/**/*.scss",
    "lint": "npm run lint:js && npm run lint:css",
    "watch:js": "watch 'npm run build:js' assets/scripts/",
    "watch:css": "watch 'npm run build:css' assets/styles/",
    "watch": "npm run watch:js & npm run watch:css"

##How to Use npm as a Build Tool

    "clean": "rimraf dist/*",

    "prebuild": "npm run clean -s",
    "build": "npm run build:scripts -s && npm run build:styles -s && npm run build:markup -s",
    "build:scripts": "browserify -d assets/scripts/main.js -p [minifyify --compressPath . --map --output dist/] | hashmark -n dist/main.js -s -l 8 -m assets.json 'dist/{name}{hash}{ext}'",
    "build:styles": "stylus assets/styles/main.styl -m -o dist/ && hashmark -s -l 8 -m assets.json dist/main.css 'dist/{name}{hash}{ext}'",
    "build:markup": "jade assets/markup/index.jade --obj assets.json -o dist",

    "test": "karma start --singleRun",

    "watch": "parallelshell 'npm run watch:test -s' 'npm run watch:build -s'",
    "watch:test": "karma start",
    "watch:build": "nodemon -q -w assets/ --ext '.' --exec 'npm run build'",

    "open:prod": "opener",
    "open:stage": "opener http://staging.example.internal",
    "open:dev": "opener http://localhost:9090",

    "deploy:prod": "s3-cli sync ./dist/ s3://example-com/prod-site/",
    "deploy:stage": "s3-cli sync ./dist/ s3://example-com/stage-site/",

    "serve": "http-server -p 9090 dist/",
    "live-reload": "live-reload --port 9091 dist/",

    "dev": "npm run open:dev -s & parallelshell 'npm run live-reload -s' 'npm run serve -s' 'npm run watch -s'"


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment