【问题标题】:grunt: serverreload and liverelaod咕噜声:serverreload 和 liveelaod
【发布时间】:2016-02-15 09:51:52
【问题描述】:

这应该很简单,但是我花了好几个小时却没有完成这项工作,

我只需要在更新服务器代码时重新加载服务器,并在更新客户端代码时重新加载浏览器。

这是我的代码,

请帮我找出问题所在,

var path = require('path');
module.exports = function(grunt) {
  grunt.initConfig({
    express: {
      options: {
        port: 3000,
        open:'http://localhost:3000',
        hostname:'localhost',
        server: path.resolve('./app.js'),
        serverreload:true
      },
      load: {
        server: path.resolve('./app.js')
      }
    },
    watch: {
      express: {
        files: ['*/**'],
        tasks: ['express:load']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-express');

  grunt.registerTask('server', ['express:load', 'express-keepalive', 'watch']);
};

【问题讨论】:

    标签: gruntjs grunt-contrib-watch


    【解决方案1】:

    我认为您可以使用 nodemon 运行您的服务器应用程序,然后使用 grunt 单独查看您的文件以进行 livereload。

    【讨论】:

      猜你喜欢
      • 2020-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      • 2013-12-16
      • 2014-02-26
      • 1970-01-01
      • 2013-12-18
      相关资源
      最近更新 更多