advanced grunt

andrei pfeiffer


grunt basics

http://ctrl-d.ro/autor/andreipfeiffer/

vs gulp

community

npm packages

11,804 results for ‘grunt’
5,015 results for ‘gulp’

npm downloads

18,537  of  ‘grunt’
12,957  of  ‘gulp’

streams






Grunt.next

pipe support with node-task

code

or 

configuration

custom tasks



  grunt.registerTask('customTask', function() {      // task logic
  };


storing tasks


    > tasks/customTask.js
// use commonJS syntax module.exports = function( grunt ) { grunt.registerTask('customTask', function() { // task logic }; };

loading tasks


    > Gruntfile.js

grunt.loadTasks('tasks'); // pass folder name, containing tasks


passing data



   grunt.registerTask('customTask', function() {
        // set      grunt.config.set('propertyName', 'some data');        // get
var name = grunt.config.get('propertyName');
};

use in templates



   grunt.initConfig({
taskName: '<%= propertyName %>'
});


q & a

thank you

Advanced Grunt

By Andrei Pfeiffer

Advanced Grunt

  • 822