在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:SimonDegraeve/koa-browser-sync开源软件地址:https://github.com/SimonDegraeve/koa-browser-sync开源编程语言:JavaScript 100.0%开源软件介绍:koa-browser-syncBrowserSync middleware for Koa. Use this middleware to automatically inject the necessary Installationnpm install koa-browser-sync --save-dev
// Use 0.x.x for Koa@1 and 1.x.x for Koa@2 UsageThere is two ways to use this module. ####1) Start See the BrowserSync docs for initialization options. var koa = require('koa');
var app = koa();
if (app.env == 'development') {
// Use init option to start the server, default: false
// Other options are passed directly to browser-sync
// ex: {init:true, files: ["app/css/**/*.css"], logConnections: false}
app.use(require('koa-browser-sync')({init: true}));
}
app.use(function (ctx, next){
ctx.body = '<html><body>Hello World</body></html>';
});
app.listen(3000); ####2) Get the snippet from BROWSERSYNC_SNIPPET environment variable (usefull to start var koa = require('koa');
var app = koa();
if (app.env == 'development') {
// No options or {init: false}
// The snippet must be provide by BROWSERSYNC_SNIPPET environment variable
app.use(require('koa-browser-sync')();
}
app.use(function (ctx, next){
ctx.body = '<html><body>Hello World</body></html>';
});
app.listen(3000); Notes
LicenceAuthor |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论