How to use the gulp.parallel function in gulp

To help you get started, we’ve selected a few gulp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CALIL / unitrad-ui / gulpfile.babel.js View on Github external
.pipe((page.replace_js && page.replace_js.length > 2) ? replace(page.replace_js[2].match, page.replace_js[2].replacement) : through.obj())
    .pipe(gulp.dest(destDir));
});


gulp.task('copy:assets:local', () => {
  return gulp.src([configDir + 'assets/*'], {base: configDir}).pipe(gulp.dest(destDir))
});


gulp.task('copy:assets:global', () => {
  return gulp.src(['src/assets/*'], {base: 'src'}).pipe(gulp.dest(destDir))
});


gulp.task('build:html', gulp.series(gulp.parallel('copy:assets:local', 'copy:assets:global'), () => {
  /* HTMLをビルドする */
  let page = JSON.parse(fs.readFileSync(configDir + 'pageconfig.json'));
  if (process.env.NODE_ENV !== 'production') {
    page.siteUrl = null;
  }
  let values = {
    page: page,
    url: page.siteUrl,
    head: ejs.render(fs.readFileSync('./src/html/head.ejs', {encoding: 'utf8'}), {url: page.siteUrl}),
    body: fs.readFileSync('./src/html/body.ejs', {encoding: 'utf8'}),
    script: ejs.render(fs.readFileSync('./src/html/script.ejs', {encoding: 'utf8'}), {url: page.siteUrl})
  };
  console.log(configDir + 'index.html')
  return gulp.src(['index.html'], {cwd: configDir})
    .pipe(gulpEjs(values, {}, {ext: ".html"}))
    .pipe(gulp.dest(destDir))
github PJCHENder / webapis-media-recorder / gulpfile.js View on Github external
return gulp.src(paths.dist.js)
    .pipe(uglify())      // time costed, production only
    .pipe(gulp.dest(paths.dist.main));
}

function cleanCSS() {
  return gulp.src(paths.dist.css)
  .pipe(gulpCleanCSS())
  .pipe(gulp.dest(paths.dist.main))
}

exports.clean = clean;

exports.default = gulp.series(
  clean,
  gulp.parallel(moveHTML, compileSASS, concatJS),
  serve,
  watch
);

exports.build = gulp.series(
  clean,
  gulp.parallel(moveHTML, compileSASS, concatJS),
  gulp.parallel(uglifyJS, cleanCSS)
);
github royeeshemesh / react-es6-fsm / gulpfile.js View on Github external
const gulp = require('gulp');
const HubRegistry = require('gulp-hub');
const browserSync = require('browser-sync');
const ghPages = require('gulp-gh-pages');

const conf = require('./conf/gulp.conf');

// Load some files into the registry
const hub = new HubRegistry([conf.path.tasks('*.js')]);

// Tell gulp to use the tasks just loaded
gulp.registry(hub);

gulp.task('build', gulp.series(gulp.parallel('other', 'webpack:dist')));
gulp.task('test', gulp.series('karma:single-run'));
gulp.task('test:auto', gulp.series('karma:auto-run'));
gulp.task('serve', gulp.series('webpack:watch', 'watch', 'browsersync'));
gulp.task('serve:dist', gulp.series('default', 'browsersync:dist'));
gulp.task('default', gulp.series('clean', 'build'));
gulp.task('watch', watch);

gulp.task('deploy', function() {
  return gulp.src('./dist/**/*')
    .pipe(ghPages());
});

function reloadBrowserSync(cb) {
  browserSync.reload();
  cb();
}
github apache / arrow / js / gulpfile.js View on Github external
`build:${taskName(`es5`, `umd`)}`,
            `build:${taskName(`esnext`, `cjs`)}`,
            `build:${taskName(`esnext`, `esm`)}`,
            `build:${taskName(`esnext`, `umd`)}`
        ),
        `clean:${npmPkgName}`,
        `compile:${npmPkgName}`,
        `package:${npmPkgName}`
    )
);

// And finally the global composite tasks
gulp.task(`clean:testdata`, cleanTestData);
gulp.task(`create:testdata`, createTestData);
gulp.task(`test`, gulpConcurrent(getTasks(`test`)));
gulp.task(`clean`, gulp.parallel(getTasks(`clean`)));
gulp.task(`build`, gulpConcurrent(getTasks(`build`)));
gulp.task(`compile`, gulpConcurrent(getTasks(`compile`)));
gulp.task(`package`, gulpConcurrent(getTasks(`package`)));
gulp.task(`default`,  gulp.series(`clean`, `build`, `test`));

function gulpConcurrent(tasks) {
    const numCPUs = Math.max(1, require('os').cpus().length * 0.75) | 0;
    return () => Observable.from(tasks.map((task) => gulp.series(task)))
        .flatMap((task) => Observable.bindNodeCallback(task)(), numCPUs);
}

function getTasks(name) {
    const tasks = [];
    if (targets.indexOf(`ts`) !== -1) tasks.push(`${name}:ts`);
    if (targets.indexOf(npmPkgName) !== -1) tasks.push(`${name}:${npmPkgName}`);
    for (const [target, format] of combinations(targets, modules)) {
github infamous / infamous / gulpfile.js View on Github external
function watch(task) {
    return gulp.watch('src/**/*.js', {ignoreInitial: false}, gulp.parallel(task))
}
github Lemoncode / integrate-react-legacy-apps / 05.C Angular components & directive / gulpfile.js View on Github external
gulp.task('clean', function () {
  return del(DIST_DIR);
});

gulp.task('build', gulp.series('clean', gulp.parallel('copy', 'transpile')));
gulp.task('watch', function (done) {
  gulp.watch(path.resolve(BUILD_DIR, '**', '*.css'), gulp.series('copy'));
  gulp.watch(path.resolve(BUILD_DIR, '**', '*.js'), gulp.series('copy'));
  gulp.watch(path.resolve(BUILD_DIR, '**', '*.html'), gulp.series('copy'));
  gulp.watch(path.resolve(BUILD_DIR, '**', '*.jsx'), gulp.series('transpile'));
  done();
});

gulp.task('dev', gulp.parallel('build', 'watch'));
gulp.task('default', gulp.parallel(gulp.series('build', 'connect'), 'watch'));
github meanie / angular-seed / gulpfile.js View on Github external
gulp.task('build', gulp.series(
  clean,
  gulp.parallel(
    gulp.series(copyAssets, updateRedirects),
    buildConfig,
    buildAppJs,
    buildAppCss,
    buildLibJs
  ),
  buildIndex
));

/**
 * Watch files for changes
 */
gulp.task('watch', gulp.parallel(
  watchAppJs, watchLibJs,
  watchAppCss,
  watchIndex, watchAssets, watchConfig
));

/**
 * Testing
 */
gulp.task('test', test);

/**
 * Default task
 */
gulp.task('default', gulp.series(
  'test', 'build', 'watch'
));
github minecraft-addon-tools / minecraft-addon-toolchain / packages / minecraft-addon-toolchain / v1 / index.js View on Github external
steps.buildSource
        );

        tasks.package = series(
            steps.clean,
            steps.determinePacks,
            steps.buildSource,
            steps.createMCPacks,
            steps.createMCAddon
        );

        tasks.install = series(
            steps.determineMinecraftDataDirectory,
            steps.determinePacks,
            steps.buildSource,
            parallel(
                steps.installBehavior,
                steps.installResources
            )
        );

        tasks.uninstall = series(
            steps.determineMinecraftDataDirectory,
            parallel(
                steps.cleanResources,
                steps.cleanBehavior
            )
        );

        tasks.default = tasks.install;

        const watchLoop = series(
github skaut / skaut-google-drive-gallery / gulpfile.ts / build.ts View on Github external
gulp.task( 'build:php:base', function() {
	return gulp.src( [ 'src/php/*.php' ] )
		.pipe( gulp.dest( 'dist/' ) );
} );

gulp.task( 'build:php:bundled', function() {
	return gulp.src( [ 'src/php/bundled/*.php' ] )
		.pipe( gulp.dest( 'dist/bundled/' ) );
} );

gulp.task( 'build:php:frontend', function() {
	return gulp.src( [ 'src/php/frontend/**/*.php' ] )
		.pipe( gulp.dest( 'dist/frontend/' ) );
} );

gulp.task( 'build:php', gulp.parallel( 'build:php:admin', 'build:php:base', 'build:php:bundled', 'build:php:frontend' ) );

gulp.task( 'build:png', function() {
	return gulp.src( [ 'src/png/icon.png' ] )
		.pipe( gulp.dest( 'dist/admin/' ) );
} );

gulp.task( 'build:txt', function() {
	return gulp.src( [ 'src/txt/*.txt' ] )
		.pipe( gulp.dest( 'dist/' ) );
} );

gulp.task( 'build', gulp.parallel( 'build:css', 'build:deps', 'build:ts', 'build:php', 'build:png', 'build:txt' ) );
github LiskHQ / lisk-docs / gulpfile.js View on Github external
/*const lintCssTask = createTask({
  name: 'lint:css',
  desc: 'Lint the CSS source files using stylelint (standard config)',
  call: task.lintCss(glob.css),
})*/

const lintJsTask = createTask({
  name: 'lint:js',
  desc: 'Lint the JavaScript source files using eslint (JavaScript Standard Style)',
  call: task.lintJs(glob.js),
})

const lintTask = createTask({
  name: 'lint',
  desc: 'Lint the CSS and JavaScript source files',
  call: parallel(lintJsTask),
})

const formatTask = createTask({
  name: 'format',
  desc: 'Format the JavaScript source files using prettify (JavaScript Standard Style)',
  call: task.format(glob.js),
})

const buildTask = createTask({
  name: 'build',
  desc: 'Build and stage the UI assets for bundling',
  call: task.build(srcDir, destDir, process.argv.slice(2).some((name) => name.startsWith('preview'))),
})

const bundleBuildTask = createTask({
  name: 'bundle:build',