Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-match

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-match

Does a vinyl file match a condition?

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
271K
decreased by-1.38%
Maintainers
1
Weekly downloads
 
Created

What is gulp-match?

The gulp-match package is a utility for conditionally filtering files in a Gulp stream based on a given criteria. It allows you to apply certain tasks only to files that match specific patterns or conditions.

What are gulp-match's main functionalities?

Conditional Task Execution

This feature allows you to conditionally apply tasks to files that match a specific pattern. In this example, the `uglify` task is only applied to JavaScript files.

const gulp = require('gulp');
const gulpIf = require('gulp-if');
const gulpMatch = require('gulp-match');
const uglify = require('gulp-uglify');

function isJavaScript(file) {
  return gulpMatch(file, '**/*.js');
}

gulp.task('scripts', function() {
  return gulp.src('src/**/*')
    .pipe(gulpIf(isJavaScript, uglify()))
    .pipe(gulp.dest('dist'));
});

Pattern Matching

This feature allows you to log or perform actions on files that match a specific pattern. In this example, it logs the paths of all CSS files.

const gulp = require('gulp');
const gulpMatch = require('gulp-match');

function logMatchedFiles() {
  return gulp.src('src/**/*')
    .pipe(gulp.dest('dist'))
    .on('data', function(file) {
      if (gulpMatch(file, '**/*.css')) {
        console.log('CSS file:', file.path);
      }
    });
}

gulp.task('logFiles', logMatchedFiles);

Other packages similar to gulp-match

Keywords

FAQs

Package last updated on 30 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc