https://github.com/fiveladdercon/gulp-subset
Process a subset of files in a gulp pipeline
https://github.com/fiveladdercon/gulp-subset
Last synced: 2 months ago
JSON representation
Process a subset of files in a gulp pipeline
- Host: GitHub
- URL: https://github.com/fiveladdercon/gulp-subset
- Owner: fiveladdercon
- Created: 2016-01-26T18:41:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T17:08:30.000Z (about 8 years ago)
- Last Synced: 2026-03-21T00:22:02.051Z (4 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gulp-subset
Process a subset of files in a gulp pipeline.
## Install
```
> npm install gulp-subset
```
## Usage
gulp-subset uses a pattern to select a subset of files to process.
Files that match the pattern are passed to the processing step while
the remaining files just fall through to the next step.
```javascript
var subset = require('gulp-subset');
gulp.src(['*.css','*.less'])
.pipe(subset(/less$/, less())) // Pipe .less files through less()
.pipe(cssmin())
...
```
The pattern can be a string, regex or custom function. Passing an extra
truthy value will invert the match:
```javascript
var subset = require('gulp-subset');
gulp.src(['*.css','*.less'])
.pipe(subset(/css$/, less(), true)) // Pipe non .css files through less()
.pipe(cssmin())
...
```
## API
```javascript
subset(pattern, stream [,invert])
```
#### pattern : string | regex | function
The pattern is either a string, regex or function. If it is a function, it is passed
a vinyl and must return true if the file is to be processed, false otherwise.
Passing a string pattern is a convience for the following matching function:
```javascript
function (vinyl) {
return (vinyl.relative.indexOf(pattern)>=0)
}
```
Passing a regex pattern is a convience the following matching function:
```javascript
function (vinyl) {
return (vinyl.relative.match(pattern))
}
```
#### stream
This is any operation that you would normally pass to the pipe() function.
#### invert
Passing a truthy value will invert the matching subset.
## Test
```
> npm test
```