当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser-sync.init函数代码示例

本文整理汇总了TypeScript中browser-sync.init函数的典型用法代码示例。如果您正苦于以下问题:TypeScript init函数的具体用法?TypeScript init怎么用?TypeScript init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了init函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

let runServer = () => {
  if (argv['proxy']) {
    BROWSER_SYNC_CONFIG.middleware.unshift(require('http-proxy-middleware')(
      ['/api', '/login', '/logout', '/swagger'], { target: argv['proxy'], xfwd: true}));
  }
  browserSync.init(BROWSER_SYNC_CONFIG);
};
开发者ID:austinbourdier,项目名称:election-modeling,代码行数:7,代码来源:code_change_tools.ts

示例2: function

gulp.task('browserSync', function () {
    browserSync.init({
        port: 8000,
        proxy: "http://localhost:12345"
    });

	function debounce(fn, delay) {
	  var timer = null;
	  return function () {
		var context = this, args = arguments;
		clearTimeout(timer);
		timer = setTimeout(function () {
		  fn.apply(context, args);
		}, delay);
	  };
	}

    gulp.watch(["src/**/*.ts"], ['compile', 'reloadBrowserSync']).on('change', function (e) {
        console.log('TypeScript file ' + e.path + ' has been changed. Compiling.');
    });
    gulp.watch(["src/*js", "src/**/*.html", "src/**/*.css"], ['resources', 'reloadBrowserSync']).on('change', function (e) {
        console.log('Resource file ' + e.path + ' has been changed. Updating.');
    });
    gulp.watch('src/**/*.scss', ['sass', 'resources', 'reloadBrowserSync'], function(e){
        console.log('Sass file ' + e.path + ' has been changed. Updating.');
    });

});
开发者ID:benhallouk,项目名称:HCLC-Portal,代码行数:28,代码来源:gulpfile.ts

示例3:

gulp.task("server", () => {
  server.start();
  browserSync.init({
    proxy: "localhost:" + serverPort,
    port: 7000
  });
});
开发者ID:markogresak,项目名称:color-wars,代码行数:7,代码来源:gulpfile.ts

示例4: function

gulp.task('browser-sync', ['nodemon'], function() {
	browserSync.init(null, {
		proxy: "http://localhost:6060",
		files: ["public/**/*.*","client/**/*.*"],
		browser: "google chrome",
		port: 8080,
	});
});
开发者ID:duffman,项目名称:file.renaming,代码行数:8,代码来源:gulpfile.ts

示例5:

gulp.task('serve', () => {
  browserSync.init({
    notify: false,
    server: {
      baseDir: [DIR_TMP, DIR_SRC],
      middleware: [historyApiFallback()],
      routes: {
        '/bower_components': 'bower_components',
        '/node_modules': 'node_modules'
      }
    }
  });
  gulp.watch(`${DIR_SRC}/**/*.ts`, ['ts-watch']);
  gulp.watch(`${DIR_SRC}/**/*.{css,html}`, null).on('change', browserSync.reload);
});
开发者ID:Farata,项目名称:polymer-typescript-starter,代码行数:15,代码来源:gulpfile-dev.ts

示例6: function

gulp.task("browserSync", function () {
    browserSync.init({
        port: 8000,
        proxy: "http://localhost:8080"
    });

    gulp.watch(["src/**/*.ts"], ['compile', 'reloadBrowserSync']).on('change', function (e) {
        console.log('TypeScript file ' + e.path + ' has been changed. Compiling.');
    });
    gulp.watch(["src/*.js", "src/**/*.html", "src/**/*.css"], ['resources', 'reloadBrowserSync']).on('change', function (e) {
        console.log('Resource file ' + e.path + ' has been changed. Updating.');
    });
    gulp.watch('src/**/*.scss', ['sass', 'resources', 'reloadBrowserSync'], function(e){
        console.log('Sass file ' + e.path + ' has been changed. Updating.');
    });
});
开发者ID:gitter-badger,项目名称:syntactic-library,代码行数:16,代码来源:gulpfile.ts

示例7: modRewrite

gulp.task('serve:browser-sync', 'init the browserSync server', ['build'], () => {
  browserSync.init({
    port: 3002,
    logLevel: 'info',
    logPrefix: 'FAR Client',
    server: {
      baseDir: `${PATH.dest.base}`,
      middleware: [
        modRewrite([
          '^[^\\.]*$ /index.html [L]'
        ])
      ]
    },
    browser: 'google chrome'
  });
});
开发者ID:AdamFaron,项目名称:FOO,代码行数:16,代码来源:gulpfile.ts

示例8:

let runServer = () => {
  let baseDir = APP_DEST;
  let routes:any = {
    [`${APP_BASE}${APP_DEST}`]: APP_DEST,
    [`${APP_BASE}node_modules`]: 'node_modules',
  };

  if (APP_BASE !== '/') {
    routes[`${APP_BASE}`] = APP_DEST;
    baseDir = `${DIST_DIR}/empty/`;
  }

  browserSync.init({
    middleware: [require('connect-history-api-fallback')({index: `${APP_BASE}index.html`})],
    port: PORT,
    startPath: APP_BASE,
    server: {
      baseDir: baseDir,
      routes: routes
    }
  });
};
开发者ID:2947721120,项目名称:angular2-seed,代码行数:22,代码来源:code_change_tools.ts

示例9:

let runServer = () => {
  browserSync.init(BROWSER_SYNC_CONFIG);
};
开发者ID:AriFreyr,项目名称:EveApp,代码行数:3,代码来源:code_change_tools.ts

示例10:

let runServer = () => {
  browserSync.init(getPluginConfig('browser-sync'));
};
开发者ID:austinmaclean,项目名称:faithinquest,代码行数:3,代码来源:code_change_tools.ts


注:本文中的browser-sync.init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。