javascript - Grunt apply changes after edit js files -
i created first project using grunt. have problem, because after editing js files need restart server apply changes. when edit jade files not need restart server. , problem: how add auto-refresh browser after file changed?
my gruntfile:
'use strict'; module.exports = function (grunt) { // show elapsed time @ end require('time-grunt')(grunt); // load grunt tasks require('load-grunt-tasks')(grunt); grunt.initconfig({ reload: { port: 9000, proxy: { host: 'localhost' } }, // watch config watch: { files: ['views/**/*','routes/*'], taksks: 'workon reload', options: { nospawn: true // without option specified express won't reloaded }, express: { files: [ 'app.js', '!**/node_modules/**', '!gruntfile.js' ], tasks: [ 'express:dev' ], options: { nospawn: true // without option specified express won't reloaded } } }, // clean config clean: { dist: { files: [{ dot: true, src: [ '.tmp', 'dist/*', '!dist/.git*' ] }] }, server: ['.tmp'] }, // express config express: { options: { // override defaults here }, dev: { options: { script: './bin/www' } } }, // open config open: { site: { path: 'http://localhost:9000', app: 'chrome' } } }); // register tasks // workon grunt.registertask('workon', 'start working on project.', [ 'express:dev', 'open:site', 'watch' ]); // restart grunt.registertask('restart', 'restart server.', [ 'express:dev', 'open:site', 'reload', 'watch' ]); // build grunt.registertask('build', 'build production ready assets , views.', [ 'clean:dist', 'concurrent:dist', 'useminprepare', 'imagemin', 'concat', 'cssmin', 'uglify', 'copy:dist', 'rev', 'usemin', ]); grunt.loadnpmtasks('grunt-express-server'); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-open'); grunt.loadnpmtasks('grunt-reload'); };
edit: after reload server page load slow:
why?
livereload: { options: { livereload: '<%= connect.options.livereload %>' }, files: [ ] }
i think section of watch can you
Comments
Post a Comment