How to use gulp-filter - 10 common examples

To help you get started, we’ve selected a few gulp-filter 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 takanakahiko / slack-emoji-meister / tasks / version.js View on Github external
'package.json',
    'package-lock.json',
    'app/manifest.json'
  ], {
    base: './'
  })
    // bump the version number in those files
    .pipe(bump({
      type: importance
    }))
    // save it back to filesystem
    .pipe(gulp.dest('./'))
    // commit the changed version number
    .pipe(git.commit('bump package version'))
    // read only one file to get the version number
    .pipe(filter('package.json'))
    // **tag it in the repository**
    .pipe(tagVersion())
}
github KnapsackPro / knapsack-pro-cypress / gulpfile.babel.js View on Github external
function compile() {
  const filterBinFiles = gFilter(
    `${tsProject.config.compilerOptions.outDir}/knapsack-pro-cypress.js`,
    { restore: true },
  );

  return (
    tsProject
      .src()
      .pipe(tsProject())
      .js // compile TypeScript to JavaScript
      .pipe(filterBinFiles) // filter a subset of the files
      // make them executable
      .pipe(chmod(0o755))
      // bring back the previously filtered out files
      .pipe(filterBinFiles.restore)
      .pipe(gulp.dest(paths.dest))
  );
github redfin / react-server / packages / react-server-integration-tests / gulpfile.babel.js View on Github external
gulp.task("compile", () => {
	const jsFilter = filter("**/*.js", {restore:true});

	return gulp.src("src/**")
		.pipe(jsFilter)
			.pipe(babel())
		.pipe(jsFilter.restore)
		.pipe(gulp.dest("target"));
});
github willsoto / angular-chartist.js / gulp / tasks / release.js View on Github external
gulp.task('commit-release', function() {
    return gulp.src([
            './bower.json',
            './package.json',
            './CHANGELOG.md',
            './dist'
        ])
        .pipe(git.add({
            args: '-A'
        }))
        .pipe(git.commit(`chore(release): new ${getImportance()} release`))
        .pipe(filter('bower.json'))
        .pipe(tag());
});
github CSSSR / csssr-project-template / tasks / templates.js View on Github external
gulp.task('templates', () => (
	gulp.src('app/**/*.jade')
		.pipe(plumber({errorHandler: errorHandler(`Error in \'templates\' task`)}))
		.pipe(cached('jade'))
		.pipe(gulpIf(global.watch, inheritance({basedir: 'app'})))
		.pipe(filter(file => /app[\\\/]pages/.test(file.path)))
		.pipe(jade({basedir: 'app', data}))
		.pipe(gulpIf(process.env.PRETTIFY !== false, prettify({
			braceStyle: 'expand',
			indentWithTabs: true,
			indentInnerHtml: true,
			preserveNewlines: true,
			endWithNewline: true,
			wrapLineLength: 120,
			maxPreserveNewlines: 50,
			wrapAttributesIndentSize: 1,
			unformatted: ['use']
		})))
		.pipe(gulpIf(process.env.NODE_ENV === 'production', staticHash({
			asset: 'dist',
			exts: ['js', 'css']
		})))
github vtex / toolbelt / src / render.js View on Github external
export function buildJS (manifest) {
  const componentsFilter = gfilter(`**/${buildComponentsPath}/**/*.json`, {restore: true})
  const routesFilter = gfilter(`**/${buildRoutesFilePath}`, {restore: true})
  return new Promise((resolve, reject) => {
    gulp.src(jsGlob)
    .pipe(babel({
      presets: [
        path.resolve(nodeModulesPath, 'babel-preset-es2015'),
        path.resolve(nodeModulesPath, 'babel-preset-stage-2'),
        path.resolve(nodeModulesPath, 'babel-preset-react'),
      ],
      plugins: [
        [path.resolve(nodeModulesPath, 'babel-plugin-import-rename'), {'(.less|.sass|.scss)$': '.css'}],
        path.resolve(nodeModulesPath, 'babel-plugin-vtex-render-route'),
        path.resolve(nodeModulesPath, 'babel-plugin-transform-es2015-modules-systemjs'),
      ],
    }))
    .pipe(gulp.dest(buildAssetsPath))
    .pipe(vtexRender({manifest: manifest}))
github JeffreyWay / laravel-elixir-webpack-official / src / WebpackTask.js View on Github external
gulpTask() {
        const jsFiles = filter(['**/*.js'], {restore: true});
        return (
            gulp
            .src(this.src.path)
            .pipe(this.webpack())
            .on('error', this.onError())
            .pipe(jsFiles)
            .pipe(this.minify())
            .on('error', this.onError())
            .pipe(jsFiles.restore)
            .pipe(this.saveAs(gulp))
            .pipe(this.onSuccess())
        );
    }
github kubernetes / dashboard / build / check.js View on Github external
gulp.task('update-license-headers', () => {
  const commonFilter = filter(getLicenseFileFilter('js', 'go', 'scss'), {restore: true});
  const htmlFilter = filter(getLicenseFileFilter('html'), {restore: true});
  const matchRate = 0.9;

  gulp.src(
          [path.join(conf.paths.src, getLicenseFileFilter('js', 'go', 'scss', 'html'))],
          {base: conf.paths.base})
      .pipe(commonFilter)
      .pipe(license(fs.readFileSync('build/assets/license/header.txt', 'utf8'), {}, matchRate))
      .pipe(commonFilter.restore)
      .pipe(htmlFilter)
      .pipe(license(fs.readFileSync('build/assets/license/header_html.txt', 'utf8'), {}, matchRate))
      .pipe(htmlFilter.restore)
      .pipe(gulp.dest(conf.paths.base));
});
github krux / prescribe / gulpfile.babel.js View on Github external
function build(config) {
  const basename = path.basename(config.output.filename, path.extname(config.output.filename));
  const jsOnly = filter(['**/*.js'], {restore: true});
  const mapOnly = filter(['**/*.map']);

  return () => webpackStream(config)
    .pipe(jsOnly)
    .pipe(header(BANNER))
    .pipe(rename({basename: basename, extname: '.max.js'}))
    .pipe(gulp.dest(DIST))
    .pipe(stripDebug())
    .pipe(rename({basename: basename, extname: '.js'}))
    .pipe(gulp.dest(DIST))
    .pipe(uglify({compress: {properties: false}, output: {'quote_keys': true}}))
    .pipe(header(BANNER))
    .pipe(rename({basename: basename, extname: '.min.js'}))
    .pipe(gulp.dest(DIST))
    .pipe(jsOnly.restore)
    .pipe(mapOnly)
    .pipe(gulp.dest(DIST));
github thecreation / gulp-starter-kit / tasks / favicons.js View on Github external
appleStartup: true,
          coast: true,
          favicons: true,
          firefox: true,
          opengraph: false,
          twitter: false,
          windows: true,
          yandex: false,
        },
        html: config.favicons.html,
        replace: true,
      })
    )
    .on('error', gutil.log)
    .pipe(gulp.dest(`${config.favicons.build}`))
    .pipe(filter('**/*.{xml,json,webapp}'))
    .pipe(replace('{{root}}', '/'))
    .pipe(gulp.dest(`${config.favicons.build}`))
    .pipe(browser.stream())
    .pipe(
      notify({
        title: config.notify.title,
        message: 'Favicons task complete',
        onLast: true,
      })
    );
});

gulp-filter

Filter files in a `vinyl` stream

MIT
Latest version published 12 months ago

Package Health Score

69 / 100
Full package analysis

Popular gulp-filter functions