Steps to create js-modules
Aug 1, 2014
Steps to perform once
- install
npm -
install
grunt-clisudo npm install -g grunt-cliwhich gives you the opportunity to run
Gruntfile.js-files by typing$ grunt. Gruntfiles are a bit like makefiles for c/c++, ants for java or rakefiles for ruby… -
install
grunt-initto automate project initializationsudo npm install -g grunt-init -
install some grunt templates
git clone https://github.com/gruntjs/grunt-init-commonjs.git ~/.grunt-init/commonjs --depth 1 git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile --depth 1Steps to perform for every new module
- create a project-folder e.g. by cloning the new projects repo from github.
Then
cdin this folder. -
create the gruntfile - choose one of the following:
- simple gruntfile:
grunt-init gruntfile - commonjs:
grunt-init commonjs
- simple gruntfile:
-
now let’s install all used
grunt-modulesand add them topackage.jsonas development dependencies(
--save-dev)npm install grunt --save-dev
Now take a look at package.json, Gruntfile.js and node_modules/.
package.json stores information about the packages to install with npm install into node_modules.
Gruntfile.js is read when typing grunt.