|- dist/
|- javascripts/
| - main.js
|- lib/
|- styles/
| .gitignore
| index.html
| README.md
.DS_Store
cd lib
npm init
npm install grunt grunt-contrib-jshint matchdep grunt-contrib-watch jshint-stylish --save-dev
|- dist/
|- javascripts/
| - main.js
|- lib/
| - node_modules/ (this was created when you installed your npm dependencies)
| - package.json (this was created when you ran npm init)
| - Gruntfile.js
|- styles/
| .gitignore
| index.html
| README.md
- .DS_Store
- lib/node_modules
- New tab in your terminal, you are going to be running the Grunt tasks continuously while developing
cd lib
grunt
- If you have errors initially, you will need to resolve them first, then you will need to restart Grunt tasks by running
grunt
- You will now need to preface all of your .js files with
"use strict";
at the beginning of each file. Learn more about strict mode.
We aren't pushing up all of our node_modules now so when our teammates checkout our branch and pull down our code to run it, they will need to install all of the dependencies that you listed.
Example from package.json:
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"jshint-stylish": "^2.2.1",
"matchdep": "^2.0.0"
}
- Pull down another person's code
cd lib
npm install
cd lib
npm init
npm install grunt grunt-contrib-jshint matchdep grunt-contrib-watch grunt-browserify jshint-stylish --save-dev
|- dist/
| - app.js (this is created when you run grunt)
|- javascripts/
| - example_module.js
| - example_module2.js
| - main.js
|- lib/
| - node_modules/ (this was created when you installed your npm dependencies)
| - package.json (this was created when you ran npm init)
| - Gruntfile.js
|- styles/
| .gitignore
| index.html
| README.md
- .DS_Store
- lib/node_modules
- dist/app.js
- .DS_Store
- lib/node_modules
- Creating modules that do one thing, and one thing only. This make a codebase easier to maintain, and allows for more flexibility when new features are added.
- Compiling all modules into one file dist/app.js (well, Grunt is doing this for us).
We aren't pushing up all of our node_modules or our dist directory now so when our teammates checkout our branch and pull down our code to run it, they will need to install all of the dependencies that you listed and run grunt to output dist/app.js.
Example from package.json:
"devDependencies": {
"grunt": "^1.0.1",
"grunt-browserify": "^5.2.0",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"jshint-stylish": "^2.2.1",
"matchdep": "^2.0.0"
}
- Pull down another person's code
cd lib
npm install
grunt
cd lib
npm init
npm install grunt grunt-contrib-jshint matchdep grunt-contrib-watch grunt-browserify jshint-stylish --save-dev
npm install jquery bootstrap --save
cd lib
npm init
npm install grunt grunt-contrib-jshint matchdep grunt-contrib-watch grunt-sass grunt-browserify jshint-stylish --save-dev
|- dist/
| - app.js (this is created when you run grunt)
|- javascripts/
| - example_module.js
| - example_module2.js
| - main.js
|- lib/
| - node_modules/ (this was created when you installed your npm dependencies)
| - package.json (this was created when you ran npm init)
| - Gruntfile.js
|- styles/
|- sass/
| - main.scss
| .gitignore
| index.html
| README.md
- .DS_Store
- lib/node_modules
- dist/app.js
- styles/main.css
- .DS_Store
- lib/node_modules