Grunt does not restart the server when loading the clock

I am trying to restart the server if any file changes. I can see the files that have changed, but does not restart my server.

GruntFile.js

module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
        all:{ 
            src:'**/*.js',
           }


},
concat: {
        options: {
            banner: '(function() {',
            footer: '})();'
        },
        releaseLocalHybrid: {
            src: ['config/config.local.js','lib/fuse.js','src/model.js','src/templates/hybrid.js','src/controller/hybrid.js'],
            dest: 'dist/widgets.js'
        }
},

uglify: {
        options: {
            banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
        },
        releaseLocalHybrid: {
            files: {
                'widgets.js': ['<%= concat.releaseLocalHybrid.dest %>']
            }
        }

},
connect:
    {
        server:
        {
            options:
            {
                hostname: 'localhost',
                port: 8082,
                base: {
                    path:'.',
                    options: {
                    index:'index.html',
                    maxAge: 300000
                  },

                },
                livereload: true
            }
        }
    },
  watch: {
    options: {
        livereload: true
        },
     concat: {
        files: 'config/*.js',
        tasks: 'jshint',
        options:
        {
            spawn:false
        },
      },
    }
});

grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [  'concat:releaseLocalHybrid','uglify:releaseLocalHybrid','connect', 'watch']);
grunt.registerTask('server', ['concat:releaseLocalHybrid','uglify:releaseLocalHybrid','connect','watch']);
};

      

Any suggestion or help would be appreciated.

+3


source to share


2 answers


I have watched all the files in hours so it jshint:all

keeps looking and doesn't work, but if I watch releaseLocalHybrid

it works. Thanks everyone.



+2


source


You need to specify the port to download on the stream. I use options for working with sheets:



watch: {
  less: {
    files : ['less/**/*.less']
  },
  css: {
    files: ['css/*.css'],
    options: {
      livereload: {
        port: 35750
      }
    }
  }
}

      

+1


source







All Articles