How to Automate with grunt and swig?

  node.js, question

The situation is as follows: I am doing exercises and want to use swig template to realize automation through grunt plus livereload.

First, I set the port number to 80

var port = normalizePort(process.env.PORT || '80');
 var server = http.createServer(app);
 server.listen(port);

The default request is also set

var index = require('./routes/index');
 app.use('/', index);

In this way, when directly accessing the address, you can already directly access index.html, but you want to realize automation through grunt and livereload.
In this way, watch is used.

/* Partial Code */
 watch: {
 html:{
 options:{
 livereload:{
 port: 80
 bracket
 },
 files:['views/**/*.html']
 bracket
 bracket

The default task of grunt was also set up, and grunt was successfully executed.
However, modifying the html file will not take effect in real time, but it will take effect if the server is restarted, so I think of joining the shell again.

shell:{
 run:{
 command:'node server.js --inline'
 },
 killall:{
 command:'killall node'
 bracket
 bracket
 
 watch: {
 html:{
 options:{
 livereload:{
 port: 80
 } //livereload tool. After the browser installs the plug-in, there is no need to restart the server or refresh the page. It is amazing to say
 },
 Files: ['views/*/*. html'],//if swig files change, execute the task
 tasks:['shell:run']
 bracket
 bracket

But I still can’t. I hope you can give me some help. Thank you.

By the way, what’s the use of setting up a port for livereload?

grunt watch livereload
examineenabling live reloading in your html

Why can I refresh the webpage automatically? In fact, your server started a TCP/TLS Server and monitored a port. The webpage livereload script establishes a connection with this port. When the server file changes, the server executes a refresh command to the notification browser, so that you can try how to make HTTPS server refresh automatically.