You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
786 B
26 lines
786 B
var gulp = require('gulp');
|
|
var consolidate = require('gulp-consolidate');
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
var config = require('../../config');
|
|
var allowExt = ['.html', '.pug'];
|
|
|
|
gulp.task('index-page', function() {
|
|
var fullList = fs.readdirSync(config.src.templates);
|
|
var pages = fullList.reduce(function(acc, val) {
|
|
var parsed = path.parse(val);
|
|
var name = parsed.name;
|
|
var ext = parsed.ext;
|
|
if (~allowExt.indexOf(ext)) {
|
|
return acc.concat(name + '.html');
|
|
}
|
|
return acc;
|
|
}, []);
|
|
|
|
return gulp
|
|
.src(__dirname + '/__index.html')
|
|
.pipe(consolidate('lodash', {
|
|
pages: pages
|
|
}))
|
|
.pipe(gulp.dest(config.src.root));
|
|
});
|
|
|