javascript - Grunt Live-Reload via Watch -


i'm trying configure grunt livereload js , less/css files on changes. while grunt correctly "watch" , execute assigned tasks, not livereload files. below configuration, see wrong?

module.exports = function(grunt) { grunt.initconfig({     pkg: grunt.file.readjson("package.json"),     jshint: {         files: ["gruntfile.js", "src/javascripts/**/*.js"],         options: {             globals: {                 jquery: true,                 console: true,                 module: true             }         }     },     concat: {         options: {             stripbanners: true,             banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> */\n",             separator: "\n"         },         js: {             src: ["src/javascripts/main.js", "src/javascripts/**/*.js"],             dest: "../app/assets/javascripts/application.js"         },         less: {             src: ["src/stylesheets/**/*.less"],             dest: "../app/assets/stylesheets/application.less"         }     },     watch: {         js: {             files: ["<%= jshint.files %>"],             tasks: ["jshint", "concat:js"],             options: {                 livereload: true             }         },         less: {             files: ["<%= concat.less.src %>"],             tasks: ["concat:less"],             options: {                 livereload: true             }         }     } });  grunt.loadnpmtasks("grunt-contrib");  grunt.registertask("default", ["jshint", "concat"]); }; 

note: have included following script tag within html head tag.

<script src="http://localhost:35729/livereload.js"></script> 

your config trying start 2 live reload servers on same port. if 1 live reload server trigger on watch targets add 1 livereload option @ task level:

watch: {   options: {     livereload: true   },   js: {     files: ["<%= jshint.files %>"],     tasks: ["jshint", "concat:js"],   },   less: {     files: ["<%= concat.less.src %>"],     tasks: ["concat:less"],   } } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -