Is there a way to use the filenames retrieved from gulp.src
, create in-memory files based on those names, and then pipe that stream to another destination?
For example, I am looking to gather all *.styl
files and add each file path to an in-memory file with the prefix @import
. Afterwards, I would like to pass this stream to a stylus compiler. Here is what I have in mind:
gulp.src('./src/**/*.styl',{read:false})
.pipe(function(filename){
return "@import '"+filename+"'"
})
.pipe(streamify())
.pipe(stylus())
.pipe( gulp.dest('./bin/combined.css'));
I haven't come across any suitable packages for reading and combining stylus files, so I thought of tackling this challenge differently.
I understand that issues may arise related to scoping, style precedence, and specificity rules when merging styles into one file, but it's a necessity for me.