Project PitBull - Build tool and setup code

Technologies being used client side include: 

  • backbone.js for MVC and underscore 
  • HTML5 
  • CSS3 (incl rounded corners, opacity, drop shadow)  
  • node for build etc. including grunt, snockets, lint, jshint 
  • less for css 
  • dust for templating 
  • jquery 
  • elements of twitter bootstrap 
  • grid960 
  • jasmine for testing 
  • Omniture for analytics 
  • Solr integration 
  • capistrano deploy
 
Building and linting
Lots of tasks as part of your javascript development workflow these days such as: linting, minify, running less build for css etc. so a build tool is important to have.
I want to setup an environment with a watcher to lint and build the code as changes are saved. Dice, a very smart Fluid coder colleague recommends a tool called Grunt which runs on node. So I followed his example
Ensure Node is installed.
If you have Node installed then to install Grunt run
 npm install -g grunt
I had to prefix with sudo. Node now comes with npm.
I created a grunt.js file (aka gruntfile) with some basic tasks for now for js linting.
I also configured a watch task to run lint when js files change, run 'grunt watch' on command line. Whats cool is you can specify wildcards e.g. all subfolders and js files within.
I plan to include tasks to minify etc.
You have to set file paths relative to where the grunt.js lives. My grunt is in the root folder so all file paths start from that folder. This one took my simple brain some time to figure out.

Comments

Popular posts from this blog

deep dive into Material UI TextField built by mui

angular js protractor e2e cheatsheet

react-router v6.4+ loaders, actions, forms and more