Closed movie4 closed 8 years ago
Can you provide us a complete example we would just have to run to reproduce the problem? Indeed, your problem may be related to the exact version of the modules and also to the fils that are passed in.
Thank for quick reply, here is full example https://github.com/movie4/gulp-filter-example
What you mean by not working ? I assume it worked as expected for me:
nicolasfroidure@13 ~/projects/gulp-filter-example (master●)$ ls css
1.css 2.css 3.css __main.css __main.css.map
nicolasfroidure@13 ~/projects/gulp-filter-example (master●)$ rm css/__main.css
nicolasfroidure@13 ~/projects/gulp-filter-example (master●●)$ rm css/__main.css.map
nicolasfroidure@13 ~/projects/gulp-filter-example (master●●)$ npm run cli -- gulp
> gulp-filter@ cli /Users/nicolasfroidure/projects/gulp-filter-example
> env NPM_RUN_CLI=1 "gulp"
[08:47:44] Using gulpfile ~/projects/gulp-filter-example/gulpfile.js
[08:47:44] Starting 'css'...
[08:47:44] Before gulp-filte@4.0.0 /Users/nicolasfroidure/projects/gulp-filter-example/css/__main.css.map
[08:47:44] Before gulp-filte@4.0.0 /Users/nicolasfroidure/projects/gulp-filter-example/css/__main.css
[08:47:44] Finished 'css' after 742 ms
[08:47:44] Starting 'default'...
[08:47:44] Finished 'default' after 17 μs
nicolasfroidure@13 ~/projects/gulp-filter-example (master●)$ ls css
1.css 2.css 3.css __main.css __main.css.map
'map' before work fine, 'dest' work fine, but all afte filter^ not workingr:
.pipe(map(function (code, filename) {
// Working
plugins.util.log('Before gulp-filte@4.0.0 ' +
plugins.util.colors.red(filename))
}))
.pipe(gulp.dest(path))
.pipe(plugins.filter('*.css'))
// Not working
.pipe(map(function (code, filename) {
plugins.util.log('After gulp-filte@4.0.0 ' +
plugins.util.colors.green(filename))
}))
[13:05:40] Using gulpfile /Volumes/Work/example_gulp-filter/gulpfile.js
[13:05:40] Starting 'css'...
[13:05:43] Before gulp-filte@4.0.0 /Volumes/Work/example_gulp-filter/css/__main.css.map
[13:05:43] Before gulp-filte@4.0.0 /Volumes/Work/example_gulp-filter/css/__main.css
[13:05:43] Finished 'css' after 2.43 s
Your filter doesn't work since you forgotten to add the recursive directory wildcard. Just replace *.css
per **/*.css
.
Thank for your help!
Just want to chime in and say that gulp-filter@4.0.0 is not working for me. Whether *.css
or **/*.css
is used as a filter expression, zero files after the filter. With ^3.0.1 it's working, no other changes to the code. Mac OS 10.10, node 5.8.0.
That's wieird, almost nothing changed between those versions: https://github.com/sindresorhus/gulp-filter/compare/v3.0.1...v4.0.0
Is your process.cwd() funky?
Funky? You mean am I doing anything unusual that would do weird things to process.cwd()
or so? Nope, running a (slightly modified) yo gulp-angular
boilerplate build. Can't think of anything weird going on. Node is installed via nvm, but that should also not be unusual and not influence process.cwd() either?
Edit: process.cwd()
returns the project root, as expected. ("As expected" because of course that's where I'm located when running things like gulp build
.)
Since it is the main change between the 2 versions, process.cwd() was a good candidate ;) https://github.com/sindresorhus/gulp-filter/commit/5fd40bcb63978b5d87468143ade5e7a56692c129#diff-168726dbe96b3ce427e7fedce31bb0bcL16
I hadn't done any change to my code, just upgrade gulp-filter from 3 -> 4 I was doing
return gulp.src(mainBowerFiles())
.pipe(filter('*.js'))
.pipe(concat('vendor.js'))
.pipe(uglify())
.pipe(gulp.dest('./build/js'))
Had to change it to **/*.js
and it worked
Hello, after applying
gulp-filter@4.0.0
, following plugin likevinyl-map
- not working, in older version work fine.Thanks
Example