Skip to content

Instantly share code, notes, and snippets.

@shama
Created September 3, 2013 20:50
Show Gist options
  • Save shama/6429386 to your computer and use it in GitHub Desktop.
Save shama/6429386 to your computer and use it in GitHub Desktop.
Grunt w/o a gruntfile
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