Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Grunt

James Ford
December 12, 2013

 Grunt

A brief talk introducing Grunt as a task management option for the development team.

James Ford

December 12, 2013
Tweet

More Decks by James Ford

Other Decks in Programming

Transcript

  1. Introduction ➔ Grunt is a workflow / task automation tool.

    ➔ Built on top of Node.js. ➔ Primary focus is web development. ➔ Awesome range of plugins.
  2. A workflow / task automation tool Build automation is the

    act of scripting or automating a wide variety of tasks that software developers do in their day-to-day activities including things like: • compiling computer source code into binary code • packaging binary code • running tests • deployment to production systems • creating documentation and/or release notes
  3. Built on top of It’s better than… • Shell scripts

    / Batch files • ANT • Rake ➔ It’s written in JavaScript, and we all know that. ➔ It’s modular, and manages its own dependencies in a clean, source-control friendly way.
  4. grunt-contrib-watch grunt-contrib-connect grunt-open grunt-contrib-concat grunt-contrib-sass grunt-contrib-compress grunt-contrib-clean grunt-connect-rewrite assemble grunt-karma

    grunt-imageoptim grunt-plato grunt-aws-s3 Plugins Watch filesystem for changes Start a simple web server Launch a browser Concatenate files Compile SASS files Create Zip/Tar/Gz files Empty a directory Symlinks for web server Generate a static website from templates Karma testing Optimize images JS Static code analysis Upload/Download from AWS S3 grunt-file-creator grunt-text-replace grunt-git-describe grunt-contrib-copy Create arbitrary files Replace text in files Get tags from Git Copy files
  5. Grunt does two really useful things. ➔ It ties your

    plugins together and runs them in a specific order. ➔ It normalises (to a certain extent) the format in which you supply options to the plugins. ➔ Grunt + NPM helps manage build dependencies. As an added bonus…
  6. ➔ Fresh directory / machine ➔ Node.js & Grunt Cli

    installed (but nothing more) ➔ git clone https://github.com/psyked/grunt-example-project ➔ cd grunt-example-project ➔ npm install ➔ grunt Starting from scratch*
  7. Introducing package.json ➔ It’s a standard part of Node.js ➔

    It describes your project, including its dependencies. ➔ It gets auto-updated as you ‘install’ additional plugins for your project. ➔ Create one using npm init ➔ Auto-add dependencies by installing them with the -- save-dev flag
  8. First up, let’s get started with Grunt 1. Install Node.js

    2. From the command line, run: npm install grunt-cli -g
  9. Running Grunt tasks ➔ Run a default task: grunt ➔

    Run a specific task: grunt taskname ➔ Run a task config: grunt taskname:config