本文整理匯總了TypeScript中browser-sync類的典型用法代碼示例。如果您正苦於以下問題:TypeScript browser-sync類的具體用法?TypeScript browser-sync怎麽用?TypeScript browser-sync使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了browser-sync類的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')
}
}
})
})