Last active
October 20, 2017 07:39
-
-
Save Integralist/7464000 to your computer and use it in GitHub Desktop.
Example of how to structure your Grunt files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
module.exports = function (grunt) { | |
return { | |
noop: require('./noop.js')(grunt) // result of scripts/grunt/noop.js is stored on the 'noop' property | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
module.exports = function (grunt) { | |
return { | |
runTask: function runNoopTask () { | |
grunt.log.writeln("noop run"); | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment