I have the following files
assets
---views
------pages
---------some_page.ejs
---------another_page.ejs
When I build these ejs files, I want them to go into the following file structure
public
---some_page
------index.html
---another_page
------index.html
My gulp file contains the following build command:
gulp.task('build-html', function() {
return gulp.src('assets/views/pages/*.ejs')
.pipe(ejs())
.pipe(gulp.dest('public/???')); // WHAT DO I ADD HERE TO MAKE ABOVE WORK?
});
I'm totally stumped what I need to add into the gulp.dest function to achieve the above.
Solved with gulp-rename
package:
gulp.task('build-html', function() {
return gulp.src('assets/views/pages/*.ejs')
.pipe(ejs())
.pipe(rename(function (path) {
path.dirname += "/" + path.basename;
path.basename = "index";
}))
.pipe(gulp.dest('public/'));
});