You are previewing Pro Grunt.js.
O'Reilly logo
Pro Grunt.js

Book Description

Pro Grunt.js gets you quickly up-to-speed with this popular JavaScript-based task runner. Author James Cryer takes you from initial installation all the way through to authoring successful plugins.

Using hands-on examples you will learn about CSS linting, combination, compilation and minification; JavaScript linting, AMD modules, and templates; image processing and optimizing; and creating a local server. You will then move on to more advanced topics such as LiveReload, Test Automation, Modular configuration, and combining tasks. Finally you will see how to scaffold plugins using Grunt init and Yeoman, how to test them with Mocha and Chai, and how to publish them so others can use them.

Start using Grunt.js to improve your workflows by using Pro Grunt.js today.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Contents at a Glance
  5. Contents
  6. About the Author
  7. About the Technical Reviewer
  8. Acknowledgments
  9. Introduction
  10. Chapter 1: Introducing Grunt
    1. How Can I Benefit from Grunt?
      1. Continuous Integration
    2. Speeding Up Your Workflow
    3. Every Craftsman Needs a Toolbelt
    4. Integration with Other Tools
      1. Versioning
    5. Readability
    6. Alternatives
      1. Ant
      2. Rake
      3. Gulp
    7. Summary
  11. Chapter 2: How to Use Grunt in Your Project
    1. Node.js
      1. Installing on Linux
      2. Installing on Windows
      3. Installing on Mac OS X
      4. Confirming Your Installation
    2. npm
    3. Finding Modules
    4. Installing Modules
    5. Modules
    6. Loading Modules from node_modules
    7. Defining Node.js Projects
    8. Grunt
    9. Creating a New Project to Work with Grunt
    10. Adding Grunt and Plug-ins to Your Project
      1. Configuring Tasks
    11. Working with Files
      1. Compact Format
      2. File Object Format
      3. Files Array Format
    12. Summary
  12. Chapter 3: Using Grunt with HTML and CSS
    1. The Demo App
    2. CSS Preprocessing
      1. Installing Sass
      2. Brief Introduction to Sass
      3. Variables
      4. Nesting
      5. Partials and Imports
      6. Mixins
      7. Extend/Inheritance
      8. Sass with Grunt
    3. Working with Front-End Frameworks with Grunt
      1. Bower
      2. Bower with Grunt
    4. Linting
      1. Setting a Standard for Your CSS
    5. Prefixing
    6. Minification
    7. Removing Unused or Duplicate CSS
    8. Packaging Your App for Production
    9. Versioning
    10. Summary
  13. Chapter 4: Using Grunt with JavaScript
    1. Enhancing Our To-Do List Application
    2. JavaScript Modules
      1. AMD
      2. CommonJS
      3. Combining Grunt.js and JavaScript Modules
      4. Cleaning the Build Process
    3. JavaScript Templating
    4. JavaScript Linting
    5. Modernizr
    6. Minification
    7. Documentation
    8. Summary
  14. Chapter 5: Using Grunt with Images, SVG, and Icons
    1. Compressing Images
    2. Producing Responsive Images
      1. Resizing Images with Grunt
      2. Responsive Images with srcset
    3. Producing Image Sprites
      1. Automating Sprite Creation
    4. Working with SVGs
    5. Minifying SVG
    6. Generating SVG Sprites
    7. Generating Icon Fonts
    8. Summary
  15. Chapter 6: Using Grunt for Testing and Local Development
    1. Setting Up a Local Server
      1. Keeping the Server Running
      2. Automated Browser Launching
      3. Logging Requests to Our Server
      4. Extending Our Server with Compressed Responses
    2. Testing
      1. Writing Our First Test
      2. Modifying the Output from Nodeunit
      3. Test-Driven Development with Grunt
    3. Generating Fixtures
      1. Automating Fixtures at Runtime
      2. Applying Fixture Generation
    4. Testing in the Browser
      1. Configuring Karma Test Runner
      2. Modifying Our Application to Use AMD
    5. Automating Accessibility Testing
    6. Exposing the Local Server to the Outside World
    7. Performance Testing
      1. Performancing Development Environments
    8. Summary
  16. Chapter 7: Optimizing Your Grunt Workflow
    1. Measuring Performance
    2. Loading Plug-ins
      1. Automating Loading with matchdep
      2. Automating Loading with load-grunt-tasks
      3. Deferring Automating Loading
    3. Organizing Your Gruntfile
      1. Using Modules
      2. Using Groups
      3. Extracting Common Configuration Options
    4. Running Tasks in Parallel
    5. Running Things on Changes
    6. Reloading Changes Automatically in the Browser
    7. Continuous Integration
    8. Summary
  17. Index