This repository was archived by the owner on Nov 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
#264 build process - adds various i18n helpers, html-based templates #276
Merged
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dbf55ed
build: allow content/*.html content, scopes handlebars parser, adds i…
snostorm 6095c6f
Watch: templates also watch for .html
snostorm 2f0695e
template: handlebars helpers {{i18n [scope], key}}, {{hb [scope], key…
snostorm 848351a
Adds proof-of-concept home.html (to replace index.html globally)
snostorm 6d52787
templates: adds {{link REFERENCE}} helper, example (home.short_descri…
snostorm c9cf070
templates: adds {{link REFERENCE}} helper, switches home phrases out
snostorm 8c9a676
home template: i18n changelog link
snostorm c5cc168
Adds cn/home.html example, adds warnings about replicating experiment…
snostorm 6d6b6e5
Merge branch 'master' into 264_build_process_2
snostorm 22def57
Replaces sample {cn,en}/home.html
snostorm 1979fab
Adds source/{content,languages}.js
snostorm 0624de5
Splits template.js -> util/content + new “content” gulp task
snostorm bd9d0ea
Merge remote-tracking branch 'origin/master' into 264_build_process_2
snostorm 6b68646
.html-content template build improvements**
snostorm d285844
home.styl syntax fix
snostorm 6846239
home.styl syntax fix
snostorm db5e444
Merge remote-tracking branch 'origin/master' into 264_build_process_2
snostorm f453c3a
bumps homepage content to latest master
snostorm 74f7f44
build: style and arguments usage cleanup
Fishrock123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var path = require('path'); | ||
var gulp = require('gulp'); | ||
var clone = require('gulp-clone'); | ||
var buffer = require('vinyl-buffer'); | ||
var mergeStream = require('merge-stream'); | ||
var generateContentAndTemplates = require('../util/content').generateContentAndTemplates; | ||
var through = require('through2'); | ||
|
||
gulp.task('content', function() { | ||
var base, contentJSON, languagesJSON, matchHTML, templates, templateStreams; | ||
|
||
base = path.resolve(__dirname, '..', '..'); | ||
contentJSON = require('../../source/content.js'); | ||
languagesJSON = require('../../source/languages.js'); | ||
matchHTML = /\.html$/; | ||
templates = {}; | ||
templateStreams = mergeStream(); | ||
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
Sorry, something went wrong. |
||
|
||
Object.keys(contentJSON).filter(function(key) { | ||
var article = contentJSON[key]; | ||
if (article.content && matchHTML.test(article.content)) { | ||
var contentTemplate = `source/templates/${article.content}`; | ||
if (templates[contentTemplate] == null) { | ||
templates[contentTemplate] = gulp.src(contentTemplate, {base: 'source/templates'}); | ||
} | ||
languagesJSON.forEach(function(lang) { | ||
var newpath = path.resolve(base, 'content', lang.code, article.url); | ||
var stream = templates[contentTemplate] | ||
.pipe(clone()) | ||
.pipe(through.obj(function(file, _unused_, cb) { | ||
file.base = 'content' | ||
file.path = path.join(base, 'content', lang.code, article.url); | ||
file._article = article; | ||
this.push(file); | ||
cb(); | ||
})); | ||
templateStreams.add(stream); | ||
}); | ||
} | ||
}); | ||
|
||
return templateStreams | ||
.pipe(buffer()) | ||
.pipe(through.obj(generateContentAndTemplates())) | ||
.pipe(gulp.dest('public/')) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
Sorry, something went wrong.