Skip to content

Instantly share code, notes, and snippets.

@pawelgalazka
Created October 3, 2016 07:01
Show Gist options
  • Save pawelgalazka/c378803bbaff8a4a79be1a4412393cb0 to your computer and use it in GitHub Desktop.
Save pawelgalazka/c378803bbaff8a4a79be1a4412393cb0 to your computer and use it in GitHub Desktop.
Example of npm scripts
"scripts": {
"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 main.js.map --output dist/main.js.map] | 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 http://example.com",
"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