Skip to content

Instantly share code, notes, and snippets.

@sheedy
Created December 30, 2013 17:17
Show Gist options
  • Save sheedy/8184989 to your computer and use it in GitHub Desktop.
Save sheedy/8184989 to your computer and use it in GitHub Desktop.
Load modules per-task from within the task itself for performance https://github.com/gruntjs/grunt/issues/975
module.exports = function(grunt) {
grunt.registerTask('server', function (target) {
if (target === 'build') {
return grunt.task.run([
'build',
'open',
'connect:build:keepalive'
]);
}
// Loading tasks as needed
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-grunticon');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('assemble');
grunt.task.run([
'clean:server',
'concurrent:server',
'grunticon',
'copy:server',
'connect:livereload',
'open',
'watch'
]);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment