Saturday, October 18, 2014

Further Experiments with grunt-init


The examples on https://github.com/r3b/ConnectJS2014 walk through an iterative build up of tools node --> npm --> grunt --> express

Key tool seems to be the grunt-init task which works like an archetype builder,   using  a template it sets up a standard of config files for various steps
 - package.json  :  for all module dependencies
 - Gruntfile.js :  build, test, deploy tasks.

Get new templates by cloning the Git repository to your ~/.grunt-init directory.
Command to instantiate the new archetype should be run inside an empty directory, followed by npm to download dependencies, and lastly grunt to execute default tasks.
>grunt-init {templatename}
> npm install
> grunt

Have learned since then:
> grunt -h
   lists all available tasks with handy descriptions, so easy to find out what a template does.

Curious to see how best to handle grunt-init "mashups"  and combining of templates.  Since grunt-init is for empty directories only,  seems like you still need to then iterate by hand as your project grows... or install a bunch of fluff at first for when you think you will need it later.

And have tried a couple of grunt + express templates... none of which seem to just "run" off the bat...


No comments:

Post a Comment