Skip to content

Commit

Permalink
Add clean script. Update uglify script. Add /dist/ to .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Damon Bauer committed Jan 24, 2016
1 parent 7cee0e8 commit 56351a7
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
node_modules
npm-debug.log
.sass-cache
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,8 @@ You're ready to go! Run any task by typing `npm run task` (where "task" is the n

"Lint" your JavaScript to enforce a uniform style and find errors

### `concat`
`cat src/js/* > dist/js/app.js`

Combine multiple JavaScript files into one bundle

### `uglify`
`uglifyjs dist/js/app.js -m -c > dist/js/app.min.js`
`mkdir -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

Expand Down Expand Up @@ -88,11 +83,6 @@ You're ready to go! Run any task by typing `npm run task` (where "task" is the n

Alias to run all of the `build` commands

### `build:watch`
`parallelshell 'npm run watch:css' 'npm run watch:js'`

Runs a command to start `watch:css` and `watch:js`. If a .scss or .js file changes in `src`, it's respective task will run again.

### `watch:css`
`onchange 'src/**/*.scss' -- npm run build:css`

Expand All @@ -104,9 +94,15 @@ You're ready to go! Run any task by typing `npm run task` (where "task" is the n
Watches for any .js file in `src` to change, then runs the `build:js` task.

### `watch:all`
`parallelshell 'npm run serve' 'npm run build:watch'`
`parallelshell 'npm run serve' 'npm run watch:css' 'npm run watch:js'`

Start up a new server. Run the `build:watch` task. When a .scss or .js file changes in `src`, 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`.

### `postinstall`
`npm run watch:all`

Runs `watch:all` after `npm install` is finished.


## Need help?
Feel free to [create an issue](http://github.com/damonbauer/npm-build-boilerplate/issues), [tweet me](http://twitter.com/damon_bauer), or [send me an email](mailto:[email protected]). I'd be glad to help where I can!
1 change: 0 additions & 1 deletion dist/css/main.css

This file was deleted.

Binary file removed dist/images/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion dist/images/icons.svg

This file was deleted.

1 change: 0 additions & 1 deletion dist/images/icons/book.svg

This file was deleted.

1 change: 0 additions & 1 deletion dist/images/icons/twitter.svg

This file was deleted.

1 change: 0 additions & 1 deletion dist/images/icons/weather.svg

This file was deleted.

Binary file removed dist/images/sandwich.png
Binary file not shown.
Binary file removed dist/images/sunset.jpg
Binary file not shown.
12 changes: 0 additions & 12 deletions dist/js/app.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/js/app.min.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "npm-build-boilerplate",
"version": "1.0.0",
"version": "1.0.1",
"description": "A set of common build tasks written with npm scripts.",
"scripts": {
"clean": "rm -f dist/{css/*,js/*,images/*}",
"autoprefixer": "postcss -u autoprefixer -r dist/css/*",
"scss": "node-sass --output-style compressed -o dist/css src/scss",
"lint": "eslint src/js",
Expand Down

0 comments on commit 56351a7

Please sign in to comment.