本文整理汇总了TypeScript中gulp-watch类的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-watch类的具体用法?TypeScript gulp-watch怎么用?TypeScript gulp-watch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gulp-watch类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: e2eWatch
function e2eWatch(componentName: string, componentTest: string) {
// If any tests change within components then run e2e.resources.
watch([
'src/components/*/test/**/*'
],
function (file) {
console.log('start e2e.resources - ' + JSON.stringify(file.history, null, 2));
start('e2e.copyAndCompile');
});
// If any src files change except for tests then transpile only the source ionic files
watch([
'src/**/*.ts',
'!src/components/*/test/**/*',
'!src/util/test/*'
],
function (file) {
console.log('start e2e.ngcSource - ' + JSON.stringify(file.history, null, 2));
start('e2e.copyAndCompile');
});
// If any scss files change then recompile all sass
watch(['src/**/*.scss'], (file) => {
console.log('start sass - ' + JSON.stringify(file.history, null, 2));
start('e2e.sass');
});
console.log(`http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${E2E_NAME}/components/${componentName}/test/${componentTest}/`);
start('e2e.serve');
}
示例2: e2eWatch
function e2eWatch(componentName: string, componentTest: string) {
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('../../e2e/webpack.config.js');
config.output.path = join(__dirname, '../../../');
config.entry = {
'dist/e2e/vendor': './scripts/e2e/vendor',
'dist-e2e/polyfills': './scripts/e2e/polyfills'
};
config.entry[`./dist/e2e/components/${componentName}/test/${componentTest}/index`] = `./dist/e2e/components/${componentName}/test/${componentTest}/entry`;
const compiler = webpack(config);
// If any tests change within components then run e2e.resources.
watch([
'src/components/*/test/**/*'
],
function(file) {
console.log('start e2e.resources - ' + JSON.stringify(file.history, null, 2));
start('e2e.copyAndCompile');
});
// If any src files change except for tests then transpile only the source ionic files
watch([
'src/**/*.ts',
'!src/components/*/test/**/*',
'!src/util/test/*'
],
function(file) {
console.log('start e2e.ngcSource - ' + JSON.stringify(file.history, null, 2));
start('e2e.copyAndCompile');
});
// If any scss files change then recompile all sass
watch(['src/**/*.scss'], (file) => {
console.log('start sass - ' + JSON.stringify(file.history, null, 2));
start('e2e.sass');
});
new WebpackDevServer(compiler, {
noInfo: true,
quiet: false,
watchOptions: {
aggregateTimeout: 2000,
poll: 1000
}
}).listen(LOCAL_SERVER_PORT, 'localhost', function(err) {
if (err) {
throw err;
}
console.log(`http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${E2E_NAME}/components/${componentName}/test/${componentTest}/`);
});
}
示例3: function
task('e2e.watch', ['e2e'], function () {
watchTask('e2e.bundle');
watch('src/components/*/test/**/*', function (file) {
start('e2e.build');
});
});
示例4: gulpWatch
let watchPath = (p) => {
gulpWatch(
p,
{
read: false, // performance optimization: do not read actual file contents
verbose: true
},
(vinyl) => processChange(vinyl));
};
示例5: concatApp
export default async function (env: string, target: string) {
watch([
`./src/${target}/**/*.html`,
'!./src/index.html'
], async function(event) {
minHtml(target).on('end', () => {
gutil.log(gutil.colors.green('minHtml complete'))
})
})
watch(['./.tmp/scripts/**/*.js'], async function (event) {
await concatApp(env, target)
gutil.log(gutil.colors.blue('concat complete'))
})
watch([
'./src/less/*.less',
'./src/components/**/*.less',
`src/${target}/**/*less`
], (event) => {
less(target)
})
watch('./src/components/et/**/*.html', async function (event) {
await et()
gutil.log(gutil.colors.cyan('et compile complete'))
})
watch('./src/**/*.ts', (event) => {
lint()
})
.on('error', function (error) {
gutil.log(error)
this.emit('end')
})
return await webpack(env, target, true, async function (resolve) {
gutil.log(gutil.colors.yellow('webpack complete'))
await concatApp(env, target)
gutil.log(gutil.colors.cyan('concat app complete'))
resolve()
})
}
示例6:
gulp.task('build', () => {
var files = [
'app/**/*.ts',
'lib/**/*.ts',
'components/**/*.ts',
];
gulp.src(files, { base: '..' })
.pipe(watch(files, { base: '..' }));
});
示例7: watchTask
function watchTask(task) {
watch([
'src/**/*.ts',
'!src/components/*/test/**/*',
'!src/util/test/*'
],
function (file) {
if (file.event !== 'unlink') {
start(task);
}
}
);
watch('src/**/*.scss', function () {
start('e2e.sass');
});
start('e2e.serve');
}
示例8: demosWatch
function demosWatch(componentName: string, componentTest: string) {
// If any tests change within components then run demos.resources.
watch([
'demos/src/**/*'
],
function (file) {
console.log('start demos.resources - ' + JSON.stringify(file.history, null, 2));
start('demos.copyAndCompile');
});
// If any src files change except for tests then transpile only the source ionic files
watch([
'src/**/*.ts',
'!src/components/*/test/**/*',
'!src/util/test/*'
],
function (file) {
console.log('start demos.ngcSource - ' + JSON.stringify(file.history, null, 2));
start('demos.copyAndCompile');
});
// If any scss files change then recompile all sass
watch(['src/**/*.scss'], (file) => {
console.log('start sass - ' + JSON.stringify(file.history, null, 2));
start('demos.sass');
});
let serverUrl = `http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${DEMOS_NAME}`;
if (componentName) {
serverUrl += `/${componentName}`;
}
console.log(serverUrl);
start('demos.serve');
}
示例9: gulpWatch
let watch = (callback?) => {
watchCallback = callback || watchCallback;
return gulpWatch(
Object.keys(watches),
{
read: false, // performance optimization: do not read actual file contents
verbose: true
},
(vinyl) => {
if (vinyl.path && vinyl.cwd && vinyl.path.startsWith(vinyl.cwd)) {
let pathToAdd = vinyl.path.substr(vinyl.cwd.length + 1);
log(`Watcher: Adding path ${pathToAdd} to pending build changes...`);
pendingRefreshPaths.push(pathToAdd);
refresh();
}
});
};