grunt watch live reload file

gruntfile.js

 

module.exports = function(grunt) {
grunt.initConfig({
 pkg: grunt.file.readJSON("package.json"),
 jshint: {
 files: ["Gruntfile.js", "src/*.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 %>",'src/*.html'],
 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"]);
};

 

package.json

 

{
 "name": "my-project-name",
 "version": "0.1.0",
 "devDependencies": {
 "grunt": "~0.4.1",
 "grunt-contrib": "",
 "grunt-contrib-jshint": "~0.6.3",
 "grunt-contrib-nodeunit": "~0.2.0",
 "grunt-contrib-watch": "~0.5.3",
 "grunt-contrib-uglify": "~0.2.2",
 "connect-livereload": "~0.3.0",
 "grunt-contrib-connect": "~0.5.0"
 }
}

 

 

Advertisements

About rahul23134654

Hi, I am Rahul Meha , B.E. in (I.T.)
This entry was posted in UI Js. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s