# HG changeset patch # User rougeronj # Date 1429799862 -7200 # Node ID 4f0b6f345564d5c672e3d8ca60bf003afae80a18 # Parent 6447f10b7d2c99bb3963b8c91aec33118e0fd5e6 add grunt-contrib-watch and a watch task to detect modification of js/css/html and launch the corresping task to build the application again diff -r 6447f10b7d2c -r 4f0b6f345564 client/bower.json --- a/client/bower.json Sat Apr 18 17:53:02 2015 +0200 +++ b/client/bower.json Thu Apr 23 16:37:42 2015 +0200 @@ -25,13 +25,13 @@ ], "dependencies": { "backbone": "~1.1.2", - "underscore": "~1.8.2", "jquery": "~2.1.3", "jquery-mousewheel": "~3.1.12", "paper": "~0.9.22", "FileSaver": "*", "backbone-relational": "~0.9.0", - "requirejs": null + "requirejs": null, + "underscore": "~1.8.3" }, "devDependencies": { "jquery-ui": "~1.11.4" diff -r 6447f10b7d2c -r 4f0b6f345564 client/gruntfile.js --- a/client/gruntfile.js Sat Apr 18 17:53:02 2015 +0200 +++ b/client/gruntfile.js Thu Apr 23 16:37:42 2015 +0200 @@ -14,8 +14,8 @@ 'js/ldtjson-bin.js', 'js/list-bin.js', 'js/wikipedia-bin.js', + 'dist/js/paper-renderer.js', 'dist/js/templates.js', - 'dist/js/paper-renderer.js', ]; var renkan_banner = grunt.file.read('js/header.js').toString() + @@ -144,12 +144,28 @@ } } }, + watch: { + css:{ + files: ['css/**/*.css'], + tasks: ['cssmin', 'copy:renkan_css'], + }, + js:{ + files: ['js/**/*.js', 'templates/**/*.html'], + tasks: ['jshint', 'requirejs', 'jst', 'concat', 'uglify', 'copy:renkan', 'clean:renderer'], + }, + lib:{ + files: ['bower.json'], + tasks: ['bower:install', 'copy:renkan'], + }, + options: { + interrupt: true, + }, + }, connect: { server: { options: { port: 9001, base: '.', - keepalive: true, useAvailablePort: true, debug: true, middleware: function(connect, options, middlewares) { @@ -172,12 +188,14 @@ grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-bower-task'); grunt.loadNpmTasks('grunt-contrib-jst'); + grunt.loadNpmTasks('grunt-contrib-watch'); // Default task(s). grunt.registerTask('default', ['jshint', 'requirejs', 'jst', 'concat', 'uglify', 'cssmin', 'bower:install', 'copy:renkan', 'copy:renkan_css', 'clean:renderer', 'clean:jst']); grunt.registerTask('copy-server', 'copy files to server part', function(){ grunt.task.run(['copy:renkan_server']); }); + grunt.registerTask('dev', [ 'jshint', 'requirejs', 'jst', 'concat', 'uglify', 'cssmin', 'bower:install', 'copy:renkan', 'copy:renkan_css', 'clean:renderer', 'connect:server', 'watch']); }; diff -r 6447f10b7d2c -r 4f0b6f345564 client/package.json --- a/client/package.json Sat Apr 18 17:53:02 2015 +0200 +++ b/client/package.json Thu Apr 23 16:37:42 2015 +0200 @@ -20,6 +20,7 @@ "grunt-contrib-jst": "^0.6.0", "grunt-contrib-requirejs": "^0.4.4", "grunt-contrib-uglify": "^0.4.0", + "grunt-contrib-watch": "^0.6.1", "jshint-stylish": "^0.2.0" }, "author": "IRI"