如何使用gulp-connect与IIS

时间:2016-12-16 17:14:22

标签: iis gulp

当我在前端更改某些内容时,我正在使用库gulp-connect刷新我的浏览器...但是就像你知道它在localhost:8080这样的服务器中工作...问题是我的后端在IIS.I想知道当我在localhost:80(IIS)中更改它时,是否有某种方法可以将我的IIS与gulp-connet连接以刷新我的代码?也许是中间件或类似的东西?

1 个答案:

答案 0 :(得分:0)

使用浏览器同步会更好:

//Set up the proxy
const browserSyncStart = () => { browserSync.init({ proxy: 'localhost' }); };

//set up a watch
const watcher = () => { return gulp.watch(src).on('all', () => { compileLess().on('end', publish); }); };

//Let the publish function also reload the browser
export const publish = () => {
  // Check if the folder exists
  if (fs.existsSync(config.publishPath)) {
    //copy from /dist to /wwwroot
    del(config.publishPath + 'dist/**/*', { force: true });
    gulp.src(config.theming.dist + '/**/*').pipe(gulp.dest(config.publishPath + 'dist'));
    browserSync.reload();
  } else {
    log(c.red(config.publishPath + ' does not exist.'));
  }
};

//Create a task, run with gulp watch
export const watch = gulp.parallel(browserSyncStart, watcher);