本文整理汇总了TypeScript中browser-sync.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser-sync.default方法的具体用法?TypeScript browser-sync.default怎么用?TypeScript browser-sync.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类browser-sync
的用法示例。
在下文中一共展示了browser-sync.default方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: browserSync
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({
port: PORT,
startPath: APP_BASE,
server: {
baseDir: baseDir,
middleware: [
proxy({
protocol: 'http:',
hostname: 'localhost',
port: 3000,
pathname: '/api',
route: '/api'
}),
require('connect-history-api-fallback')({index: `${APP_BASE}index.html`})
],
routes: routes
}
});
};
示例2: browserSync
export = () => {
return browserSync({
proxy: "localhost:8080", // local node app address
port: 5000, // use *different* port than above
notify: true
});
}
示例3: browserSync
gulp.task('serve', () => {
browserSync({
server: {
baseDir: APP_DEST
}
});
});
示例4: browserSync
let runServer = () => {
// Angle Start
browserSync({
port: PORT,
proxy: 'localhost',
files: `${APP_DEST}/assets/css/*.css`,
injectChanges: true
});
// Angle End
};
示例5: browserSync
let runServer = () => {
let routes:any = {
[`/${APP_DEST}`]: APP_DEST,
'/node_modules': 'node_modules'
};
browserSync({
port: PORT,
startPath: '/',
server: {
baseDir: APP_DEST,
routes: routes
}
});
};
示例6: listen
export function listen() {
sync({
'middleware': [require('connect-history-api-fallback')()],
'port': PORT,
'startPath': '/',
'server': {
'baseDir': APP_DEST,
'routes': {
[`/${APP_DEST}`]: APP_DEST,
'/node_modules': 'node_modules'
}
}
});
};
示例7: browserSync
done => {
browserSync({
online: false,
open: false,
port: 9000,
server: {
baseDir: ['.'],
middleware: function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
next();
}
}
}, done);
}
示例8: browserSync
let runServer = () => {
let routes:any = {
[`/${APP_DEST}`]: APP_DEST,
'/node_modules': 'node_modules'
};
browserSync({
middleware: [require('connect-history-api-fallback')()],
port: PORT,
startPath: '/',
server: {
baseDir: APP_DEST,
routes: routes
}
});
};
示例9: browserSync
let runServer = () => {
let routes: any = {
[`/${APP_DEST}`]: APP_DEST,
"/node_modules": "node_modules"
};
browserSync({
middleware: [require("connect-history-api-fallback")()],
port: PORT,
startPath: "/",
server: {
baseDir: APP_DEST,
routes: routes
}
});
};
示例10: browserSync
bundle(true, () => {
if (initBrowserSync) return reload()
initBrowserSync = true
browserSync({
notify: false,
port: 5001,
server: {
baseDir: ['www'],
routes: {
'/node_modules': path.join(process.cwd(), 'node_modules'),
'/www': path.join(process.cwd(), 'www')
}
}
})
})