Created
September 3, 2013 20:50
-
-
Save shama/6429386 to your computer and use it in GitHub Desktop.
Grunt w/o a gruntfile
This file contains hidden or 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
var grunt = require('grunt'); | |
// hack to avoid loading a Gruntfile | |
// You can skip this and just use a Gruntfile instead | |
grunt.task.init = function() {}; | |
// Init config | |
grunt.initConfig({ | |
jshint: { | |
all: ['index.js'] | |
} | |
}); | |
// Register your own tasks | |
grunt.registerTask('mytask', function() { | |
grunt.log.write('Ran my task.'); | |
}); | |
// Load tasks from npm | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
// Finally run the tasks, with options and a callback when we're done | |
grunt.tasks(['mytask', 'jshint'], {}, function() { | |
grunt.log.ok('Done running tasks.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment