Adding a hack to allow setting page titles
I may look for a more robust system to handle markup than just gulp-wrap
This commit is contained in:
parent
82ca4f40f7
commit
12a4186188
@ -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',
|
||||
|
12
gulpfile.js
12
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));
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
|
||||
<title>Regexper</title>
|
||||
<title>${title()}</title>
|
||||
|
||||
<meta name="description" content="Regular expression visualizer using railroad diagrams" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
Loading…
Reference in New Issue
Block a user