Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Commit e00b7f5

Browse files
committed
Fixes to the order for when handlebars should execute on markdown
1 parent 4d20e2e commit e00b7f5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

gulp/tasks/templates.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ gulp.task('templates', function() {
4141
var markdownFilesInThisLang = utils.loadMdFiles(contentFiles, lang); // load all the md files
4242

4343
_.forEach(markdownFilesInThisLang, function(file) { // iterate over the md files present in this language to apply the template to them
44-
var markdown = String(fs.readFileSync(file.srcPath)); // read in the md file, convert buffer to string
45-
var html = md.render(markdown); // convert md string to html string
44+
var markdownRaw = String(fs.readFileSync(file.srcPath)); // read in the md file, convert buffer to string
45+
var markdownHandlebars = Handlebars.compile(markdownRaw)({
46+
project: projectJSON
47+
});
48+
var html = md.render(markdownHandlebars); // convert md string to html string
4649
var thisFileJSON = _.cloneDeep(templateJSON); // clone in the template JSON object
4750
var pageTitle = thisFileJSON['browser-title'];
4851
var filepath = __dirname.split('gulp/tasks')[0] + 'source/templates/main.html'; // get the main template file location. There can be multiple, this is just a proof of concept
@@ -71,10 +74,6 @@ gulp.task('templates', function() {
7174

7275
var contents = String(vinylFile.contents);
7376

74-
contents = Handlebars.compile(contents)({
75-
project: projectJSON
76-
});
77-
7877
var newHash = crypto
7978
.createHash("sha1")
8079
.update(vinylFile.contents, "binary")

0 commit comments

Comments
 (0)