本文整理汇总了TypeScript中browser-sync.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: startLocalhost
function startLocalhost() {
return browserSync(null, {
server: {
baseDir: ['tmp/serve']
}
})
}
示例2: browserSync
gulp.task('serve:prod', ['build:prod'], () => {
// Proxy to localhost:8080
var proxyOptions = url.parse('http://localhost:8080/api');
proxyOptions.route = '/api';
proxyOptions.preserveHost = true;
browserSync({
logPrefix: 'VASS Angular2 Test',
port: 5000,
browser: 'google chrome',
server: {
baseDir: './dist',
middleware: [function (req, res, next) {
// CORS Origin....
res.setHeader('Access-Control-Allow-Origin', '*');
next();
}, proxy(proxyOptions)]
}
});
// Watch for changes on build folder. A change on src folder will make watch task run.
// This task will put the files on build folder.
// So, we ahve to watch on build folder to reload the browser
gulp.watch([
"/build/**/*.js",
"/build/**/*.css",
"/build/**/*.html"
], browserSync.reload);
});
示例3: function
gulp.task('serve', function () {
browserSync({
server: {
baseDir: 'build',
routes: {
'/node_modules': 'node_modules'
}
}
}, function (err, bs) {
console.log(bs.options.getIn(['urls', 'local']));
});
gulp.run('watch');
gulp.watch('private/*.scss', ['scss']);
gulp.watch(['build/**/*.html', 'build/**/*.js']).on('change', browserSync.reload);
});
示例4: superstatic
gulp.task('dev', () => {
browserSync({
port: 3002,
file: ['index.html', '**/*.js', '**/*.ts', '**/*.html', '**/*.less'],
injectChange: true,
logFileChange: false,
logLevel: 'silent',
notify: true,
reloadDelay: 0,
server: {
baseDir: './',
middleware: superstatic({debug: false})
}
});
// gulp.watch(['app/**/*.less', 'app/**/*.html', 'app/**/*.ts', 'app/**/*.js', 'index.html'], ['reload']);
});
示例5: startBrowserSync
function startBrowserSync(isDev: boolean, isSpecRunner: boolean): void{
'use strict';
var tunnel = null;
var online = false;
if (args.nosync || browserSync.active) {
return;
};
if (args.online) {
tunnel = config.subdomain;
online = true;
}
console.log('Starting browser-sync on port ' + port);
if (isDev) {
gulp.watch([config.less, config.sourceTs, config.sourceHtmls], ['serve-dev', browserSync.reload])
.on('change', changeEvent);
gulp.watch([config.sourceSpecs], ['compile-specs', browserSync.reload])
.on('change', changeEvent);
} else {
gulp.watch([config.less, config.sourceTs, config.sourceHtmls], ['optimize', browserSync.reload])
.on('change', changeEvent);
gulp.watch([config.sourceSpecs], ['compile-specs', browserSync.reload])
.on('change', changeEvent);
}
var options = {
proxy: 'localhost:' + port,
port: 3000,
files: isDev ? [
config.build + '**/*.*',
config.temp + '**/*.css'
] : [],
ghostMode: true,
injectChanges: true,
logFileChanges: true,
logLevel: 'debug',
logPrefix: 'Acklen Avenue',
notify: true,
reloadDelay: 5000,
startPath: null,
tunnel: tunnel,
online: online
};
if (isSpecRunner) {
options.startPath = config.specRunnerFile;
}
browserSync(options);
}
示例6: browsersync
export = gulp.task('serve', () => {
browsersync(config.browsersync);
});
示例7: browserSync
export const create = (opts: IOptions) => browserSync(createBrowserSyncOptions(opts));