gulp.js livereload with express server?

2019-02-02 08:30发布

I am trying to setup my gulpfile.js to use livereload on an express server without much luck. I see examples out there but they seem to be related to a static file server.

http://code.tutsplus.com/tutorials/gulp-as-a-development-web-server--cms-20903 http://rhumaric.com/2014/01/livereload-magic-gulp-style/

So I have an app.js file which does the standard express server with jade files, etc. What I want to do is get it to work with livereload from a gulp.js boot.

app.set('port', process.env.PORT || 3000);
    var server = app.listen(app.get('port'), function() {
    debug('Express server listening on port ' + server.address().port);
});

There are lots of plugins like gulp-livereload, connect-livereload, gulp-connect, gulp-watch so how can I get this wired up?

7条回答
地球回转人心会变
2楼-- · 2019-02-02 09:04

gulp-express is the right thing for you. It runs your express script as a server, with livereload!

查看更多
登录 后发表回答