Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Digging Into The Grunt Work Of Development

Avatar for Steve E Steve E
August 28, 2014

Digging Into The Grunt Work Of Development

Ever take a moment to look at your development process and realize there's a lot of rote, repetitive tasks you have to perform in order to shape your code up to run? Things like pre-processing files, minification, bundling, tagging releases in source control, deploying the application, etc. Sure you can do it manually, but do you remember all the steps every single time? How about if there's multiple developers on the team who don't always do those tasks? That's where a tool like Grunt comes in useful as it can automate a lot of things from the NodeJS environment and it lives with your source code so the entire team benefits. If you can perform the task from the command line or with some server-side Javascript, you very likely can automate the process. This presentation assumes at least a familiarity with Javascript & NodeJS, and will get you up and running with Grunt.

Avatar for Steve E

Steve E

August 28, 2014
Tweet

More Decks by Steve E

Other Decks in Technology

Transcript

  1. The Development Cycle So Far •Install prerequisites ...convert caffeine to

    working code... •Precompile •Minify/Compress/Uglify •Test •Deploy
  2. Installing Step 1 Step 2 npm install -g grunt-cli Step

    3 npm install grunt --save-dev Step 4 edit Gruntfile.js
  3. NPM Package.json { "name": "my-project-name", "version": "0.1.0", "devDependencies": { "grunt":

    "~0.4.5", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-nodeunit": "~0.4.1", "grunt-contrib-uglify": "~0.5.0" } }
  4. An “actual” Gruntfile module.exports = function(grunt) { grunt.registerTask(‘default’, ‘A good

    description’, function() { // Actually do grunt-related things here grunt.log.write(‘Daisy, daisy, give me your answer do’); }); };
  5. Plug-Ins http://gruntjs.org/plugins • Grunt-contrib-watch • Grunt-contrib-jshint • Grunt-contrib-uglify • Grunt-contrib-clean

    • Grunt-contrib-concat • Grunt-contrib-copy • Grunt-contrib-less • Grunt-contrib-htmlmin • Grunt-contrib-requires • Grunt-contrib-jasmine • Grunt-bower-install • … a LOT more...
  6. Load Plugin Tasks module.exports = function(grunt) { // Load it...

    grunt.loadNpmTasks(‘grunt-contrib-watch’); // Execute as part of default grunt.registerTask(‘default’, [‘uglify’]); };
  7. Where To Go From Here • Create custom Tasks •

    Multi Tasks • Gulp (http://gulpjs.com) • Brunch (http://brunch.io)