diff --git a/config.js b/config.js index 6cf96f4..50c3229 100644 --- a/config.js +++ b/config.js @@ -5,6 +5,11 @@ var path = require('path'), buildPath = _.bind(path.join, path, buildRoot); module.exports = { + titles: { + '_': 'Regexper', + 'changelog.html': 'Regexper - Changelog', + 'documentation.html': 'Regexper - Documentation' + }, buildRoot: buildRoot, buildPath: buildPath, templateFile: './template.html', diff --git a/gulpfile.js b/gulpfile.js index a47cdc3..22b6ac3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -38,11 +38,19 @@ gulp.task('static', function() { }); gulp.task('markup', function() { - var wrap = require('gulp-wrap'); + var wrap = require('gulp-wrap'), + path = require('path'); return gulp.src(config.globs.html, { base: './src' }) .pipe(errorHandler()) - .pipe(wrap({ src: config.templateFile })) + .pipe(wrap({ src: config.templateFile }, { + title: function() { + var root = path.join(this.file.cwd, this.file.base), + file = path.relative(root, this.file.history[0]); + + return config.titles[file] || config.titles['_']; + } + })) .pipe(gulp.dest(config.buildRoot)); }); diff --git a/template.html b/template.html index d35fcf7..9a48e00 100644 --- a/template.html +++ b/template.html @@ -4,7 +4,7 @@ - Regexper + ${title()}