本文整理汇总了TypeScript中gulp.series函数的典型用法代码示例。如果您正苦于以下问题:TypeScript series函数的具体用法?TypeScript series怎么用?TypeScript series使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了series函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: watchJekyll
function watchJekyll(neverDone) {
return watch([
'src/**/*.{csv,html,md,yml}'
],
series(buildJekyll, function reloadBrowsers(done) {
browserSync.reload()
done()
}))
}
示例2: done
gulp.task('clean.once', (done: any) => {
if (firstRun) {
firstRun = false;
gulp.series([ 'clean.dev' ])(done);
} else {
util.log('Skipping clean on rebuild');
done();
}
});
示例3: watch
function watch(){
return gulp.watch([
`${paths.src}/**/*`,
`index.html`,
`systemjs.config.js`,
`styles.css`,
`!${paths.src}/**/*.spec.ts`
], gulp.series('build:dev'));
}
示例4: debounce
let refresh = debounce(() => {
if (isBuilding) {
log('Watcher: A build is already in progress, deferring change detection...');
return;
}
isBuilding = true;
let paths = pendingRefreshPaths.splice(0);
let refreshTasks = [];
// determine which tasks need to be executed
// based on the files that have changed
for (let watcher of watches) {
if (Array.isArray(watcher.source)) {
for(let source of watcher.source) {
if (paths.find(path => minimatch(path, source))) {
refreshTasks.push(watcher);
}
}
}
else {
if (paths.find(path => minimatch(path, watcher.source))) {
refreshTasks.push(watcher);
}
}
}
if (refreshTasks.length === 0) {
log('Watcher: No relevant changes found, skipping next build.');
isBuilding = false;
return;
}
log(`Watcher: Running ${refreshTasks.map(x => x.name).join(', ')} tasks on next build...`);
let toExecute = gulp.series(
readProjectConfiguration,
gulp.parallel(refreshTasks.map(x => x.callback)),
writeBundles,
(done) => {
isBuilding = false;
watchCallback();
done();
if (pendingRefreshPaths.length > 0) {
log('Watcher: Found more pending changes after finishing build, triggering next one...');
refresh();
}
}
);
toExecute();
}, debounceWaitTime);
示例5: compileAndWatch
export function compileAndWatch(options) {
const tsProject = options.tsProject || createTsProjectFromOptions(options);
const boundCompile = compile.bind(Object.assign(options, {
tsProject
}));
return series(boundCompile, () => {
watch(getCompilePaths(options.compilePaths), {interval: 1000, usePolling: true}, boundCompile)
.on('change', () => {
log('=== Source change detected. Recompiling...');
});
})();
}
示例6: compileAndBundle
export function compileAndBundle(options) {
let startTime = new Date();
return promisify(series(
compile.bind(undefined, options.compile || {}),
bundle.bind(undefined, options.bundle || {}),
(done) => {
const completionTime = Math.round((new Date().getTime() - startTime.getTime()) / 1000 * 100) / 100;
log('------------------------------------------');
log(`=== Compilation and bundling completed in ${completionTime} sec.`);
log('------------------------------------------');
done();
}
));
}
示例7: debounce
let refresh = debounce(() => {
if (isBuilding) {
log('Watcher: A build is already in progress, deferring change detection...');
return;
}
isBuilding = true;
let paths = pendingRefreshPaths.splice(0);
let refreshTasks = [];
// Dynamically compose tasks
for (let src of Object.keys(watches)) {
if (paths.find((x) => minimatch(x, src))) {
log(`Watcher: Adding ${watches[src].name} task to next build...`);
refreshTasks.push(watches[src].callback);
}
}
if (refreshTasks.length === 0) {
log('Watcher: No relevant changes found, skipping next build.');
isBuilding = false;
return;
}
let toExecute = gulp.series(
readProjectConfiguration,
gulp.parallel(refreshTasks),
writeBundles,
(done) => {
isBuilding = false;
watchCallback();
done();
if (pendingRefreshPaths.length > 0) {
log('Watcher: Found more pending changes after finishing build, triggering next one...');
refresh();
}
}
);
toExecute();
}, debounceWaitTime);
示例8: getLanguages
gulp.task('build-frontend', (() => {
const languages = getLanguages().filter((l) => {
return l !== 'en';
});
const tasks = [];
createFrontendTask('build-frontend-release default',
'ng build --aot --prod --output-path=./release/dist --no-progress --i18n-locale=en' +
' --i18n-format xlf --i18n-file frontend/' + translationFolder + '/messages.en.xlf' +
' --i18n-missing-translation warning');
tasks.push('build-frontend-release default');
for (let i = 0; i < languages.length; i++) {
createFrontendTask('build-frontend-release ' + languages[i],
'ng build --aot --prod --output-path=./release/dist/' + languages[i] +
' --no-progress --i18n-locale=' + languages[i] +
' --i18n-format xlf --i18n-file frontend/' + translationFolder + '/messages.' + languages[i] + '.xlf' +
' --i18n-missing-translation warning');
tasks.push('build-frontend-release ' + languages[i]);
}
return gulp.series(...tasks);
})());
示例9: compileBundleAndWatch
export function compileBundleAndWatch(options) {
options = Object.assign({
compile: {},
bundle: {}
}, options);
const boundCompileAndBundle = () => {
return compileAndBundle(options)
.then(() => log('==== Watching for changes... ===='));
};
return promisify(series(
boundCompileAndBundle,
() => {
return watch(getCompilePaths(options.compile.compilePaths), {
interval: 1000,
usePolling: true
}, boundCompileAndBundle)
.on('change', () => {
log('=== Source change detected. Recompiling...');
});
}));
}