Added grunt server task to run server+watch

This commit is contained in:
jdescottes 2014-05-05 23:08:11 +02:00
parent bc23e9cea6
commit adca1bbd08
2 changed files with 33 additions and 10 deletions

View File

@ -64,12 +64,29 @@ module.exports = function(grunt) {
base : '.', base : '.',
port : 4321 port : 4321
} }
}
}, },
serve : { express: {
server: {
options: { options: {
base : '.', port: 9001,
port : 1234, hostname : 'localhost',
keepalive : true bases: ['dest']
}
}
},
open : {
server : {
path : 'http://localhost:9001/'
}
},
watch: {
scripts: {
files: ['src/**/*.*'],
tasks: ['merge'],
options: {
spawn: false
} }
} }
}, },
@ -175,14 +192,17 @@ module.exports = function(grunt) {
src: ['src/css/**/*.css'] src: ['src/css/**/*.css']
}); });
grunt.loadNpmTasks('grunt-closure-tools');
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-closure-tools'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express');
grunt.loadNpmTasks('grunt-ghost'); grunt.loadNpmTasks('grunt-ghost');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-leading-indent'); grunt.loadNpmTasks('grunt-leading-indent');
// Validate // Validate
@ -202,6 +222,6 @@ module.exports = function(grunt) {
// Validate & Build // Validate & Build
grunt.registerTask('default', ['clean:before', 'lint', 'compile', 'merge']); grunt.registerTask('default', ['clean:before', 'lint', 'compile', 'merge']);
// Start webserver // Start webserver and watch for changes
grunt.registerTask('serve', ['connect:serve']); grunt.registerTask('server', ['express', 'open', 'watch']);
}; };

View File

@ -19,7 +19,10 @@
"grunt-contrib-copy": "0.5.0", "grunt-contrib-copy": "0.5.0",
"grunt-contrib-jshint": "0.5.4", "grunt-contrib-jshint": "0.5.4",
"grunt-contrib-uglify": "0.2.2", "grunt-contrib-uglify": "0.2.2",
"grunt-contrib-watch": "0.6.1",
"grunt-express": "1.0",
"grunt-ghost": "1.0.12", "grunt-ghost": "1.0.12",
"grunt-open": "0.2.3",
"grunt-leading-indent": "0.1.0", "grunt-leading-indent": "0.1.0",
"grunt-closure-tools": "~0.8.3" "grunt-closure-tools": "~0.8.3"
} }