In my gulpfile.js
, I am attempting to configure a setup that concatenates all .js
files located in the src/js
folder and names them based on their parent folder.
Here is an example of the folder structure:
project
|
+-assets
| |
| +-app.min.js
| |
| +-vendor.min.js
|
+-src
| |
| +-app
| | |
| | +-file1.js
| | |
| | +-file2.js
| |
| +-vendor
| | |
| | +-file1.js
| | |
| | +-file2.js
While I have been able to set it up for specific folders with designated file names, I am in search of a function that can dynamically handle varying folder structures and names.
Previously, I was using the following configuration:
gulp.task('js', function () {
gulp.src('src/js/app/**/*.js')
.pipe(plumber(plumberErrorHandler))
.pipe(jshint())
.pipe(jshint.reporter('fail'))
.pipe(concat('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js'))
});