ttsvetko
11/14/2013 - 9:31 AM

Example of how to structure your Grunt files

Example of how to structure your Grunt files

"use strict";

module.exports = function (grunt) {
    return {
        runTask: function runNoopTask () {
            grunt.log.writeln("noop run");
        }
    };
};
"use strict";

module.exports = function (grunt) {
    return {
        noop: require('./noop.js')(grunt) // result of scripts/grunt/noop.js is stored on the 'noop' property
    };
};
module.exports = function (grunt) {
    "use strict";

    var tasks = require('./scripts/grunt')(grunt); // this points to a directory and not a file (there should be an index.js inside the directory for this to work)

    grunt.registerTask('noop', 'A no-operation task -> useful in testing situations', tasks.noop.runTask);
};
module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({

        // Store your Package file so you can reference its specific data whenever necessary
        pkg: grunt.file.readJSON('package.json')
        
        // ...tasks...
        
    });

    // Default task
    grunt.registerTask('default', ['...']);

    // Load custom tasks...
    require('./grunt-customtasks.js')(grunt);

};