当我在我的前端改变一些东西时,我正在使用库gulp-connect来刷新我的浏览器。但正如您所知道的,它在localhost:8080这样的服务器上工作...问题是我的后端在IIS中,我想知道当我在localhost:80 (IIS)中更改它时,是否有某种方法可以将我的IIS连接到gulp-connet来刷新我的代码?也许是一个中间件或类似的东西?
发布于 2018-10-12 14:53:37
你最好使用browsersync:
//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);https://stackoverflow.com/questions/41189314
复制相似问题