本文整理汇总了TypeScript中tiny-lr类的典型用法代码示例。如果您正苦于以下问题:TypeScript tiny-lr类的具体用法?TypeScript tiny-lr怎么用?TypeScript tiny-lr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了tiny-lr类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: serveSPA
import * as connectLivereload from 'connect-livereload';
import * as express from 'express';
import * as tinylrFn from 'tiny-lr';
import * as openResource from 'open';
import * as serveStatic from 'serve-static';
import {resolve} from 'path';
import {APP_BASE, APP_DEST, LIVE_RELOAD_PORT, PORT} from '../config';
let tinylr = tinylrFn();
export function serveSPA() {
let server = express();
tinylr.listen(LIVE_RELOAD_PORT);
server.use(
APP_BASE,
connectLivereload({ port: LIVE_RELOAD_PORT }),
express.static(process.cwd())
);
server.listen(PORT, () =>
openResource('http://localhost:' + PORT + APP_BASE + APP_DEST)
);
}
export function notifyLiveReload(e) {
let fileName = e.path;
tinylr.changed({
body: { files: [fileName] }
});
开发者ID:jtborst,项目名称:instaMoneyDashboard,代码行数:31,代码来源:server.ts
示例2: notifyLiveReload
import * as tslintStylish from 'gulp-tslint-stylish';
import * as shell from 'gulp-shell';
import * as nodemon from 'gulp-nodemon';
import {Server} from 'karma';
import * as ts from 'gulp-typescript';
import * as sourcemaps from 'gulp-sourcemaps';
import * as tinylrFn from 'tiny-lr';
import {PATH, LIVE_RELOAD_PORT, APP_BASE, APP_VERSION, DEPS_SRC} from './tools/config';
export const templateLocals = {
APP_VERSION,
APP_BASE
};
const tinylr = tinylrFn();
export function notifyLiveReload(changedFiles: string[]) {
tinylr.changed({
body: { files: changedFiles }
});
}
const tsProject = ts.createProject('tsconfig.json');
function compileTs(src: string | string[], dest: string, inlineTpl?: boolean): NodeJS.ReadWriteStream {
let result = gulp.src(src)
.pipe(plumber())
.pipe(sourcemaps.init());
开发者ID:kgeorgieva,项目名称:kristina-georgieva-angular2-site,代码行数:30,代码来源:gulpfile.ts
示例3: notifyLiveReload
import * as gulp from 'gulp';
import {join} from 'path';
import * as inject from 'gulp-inject';
import * as template from 'gulp-template';
import * as tinylrFn from 'tiny-lr';
import {PATH, APP_BASE, APP_VERSION, LIVE_RELOAD_PORT} from './config';
export const tinylr = tinylrFn();
export function notifyLiveReload(changedFiles: string[]) {
tinylr.changed({
body: { files: changedFiles }
});
}
export function buildInjectable(paths: string[], newBaseDir?: string, newExt?: string): NodeJS.ReadWriteStream {
const rws = gulp.src(
paths
.filter(path => !/(\.map)$/.test(path), { read: false })
);
return rws;
}
export function transformPath(filepath: string, newBaseDir: string) {
const namePos = filepath.lastIndexOf('/') + 1;
const filename = filepath.substring(namePos);
filepath = newBaseDir === '' ? filename : newBaseDir + '/' + filename;
return filepath;
}
开发者ID:australdev,项目名称:app,代码行数:30,代码来源:tasks-tools.ts
示例4: tinylr
}).once('start', () => {
const tinylrObj = tinylr();
tinylrObj.listen(LIVE_RELOAD_PORT);
const intervalId = setInterval(() => {
const existsDist = fse.existsSync(PATHS.dest.dist.appBundle);
if (existsDist) {
clearInterval(intervalId);
setTimeout(() => {
openResource(`http://localhost:${PORT}`);
done();
}, 3000);
}
}, 500);
})
开发者ID:brunkb,项目名称:a2-contact,代码行数:14,代码来源:gulpfile.ts
示例5: createLiveReloadServer
export function createLiveReloadServer(config: ServeConfig) {
const liveReloadServer = tinylr();
liveReloadServer.listen(config.liveReloadPort, config.host);
function fileChange(changedFiles: ChangedFile[]) {
// only do a live reload if there are no diagnostics
// the notification server takes care of showing diagnostics
if (!hasDiagnostics(config.buildDir)) {
liveReloadServer.changed({
body: {
files: changedFiles.map(changedFile => '/' + path.relative(config.wwwDir, changedFile.filePath))
}
});
}
}
events.on(events.EventType.FileChange, fileChange);
events.on(events.EventType.ReloadApp, () => {
fileChange([{ event: 'change', ext: '.html', filePath: 'index.html'}]);
});
}
开发者ID:Kode-Kitchen,项目名称:ionic-app-scripts,代码行数:22,代码来源:live-reload.ts
注:本文中的tiny-lr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论