Skip to content

Commit 42cd782

Browse files
committed
Save original file path in advance for JA files
1 parent 82c4c69 commit 42cd782

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

build/createFiddleFiles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module.exports = function(options) {
6767
var contents, stream, $,
6868
basePath = path.dirname(file.path),
6969
relativePath = basePath.split("HTMLSamples").pop().replace(/\\/g, "/"),
70-
originalPath = "HTMLSamples" + file.history[0].split("HTMLSamples").pop().replace(/\\/g, "/"),
70+
originalPath = "HTMLSamples" + file.originalPath.split("HTMLSamples").pop().replace(/\\/g, "/"),
7171
htmlFile, jsFile, cssFile,
7272
html = [], js = "", css = "",
7373
resultStr = file.lang === "ja" ? options.strings.resultJA : options.strings.resultEN,

build/localizeFiles.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module.exports = function(options) {
3232
contentsJA = contentsJA.replace(token, jaStrings[key]);
3333
}
3434

35+
// save original path, because hystory stack won't be available for the newly created JA file:
36+
file.originalPath = file.history[0];
3537
// change out path, HTMLSamples must remain in path to keep relative correct for dest
3638
file.path = path.join(basePath.replace("HTMLSamples", "HTMLSamples" + path.sep + "EN"), fileName, "index.html");
3739
file.contents = new Buffer(contentsEN, encoding);
@@ -44,6 +46,7 @@ module.exports = function(options) {
4446
contents: new Buffer(contentsJA)
4547
});
4648
jaFile.lang = "ja";
49+
jaFile.originalPath = file.originalPath;
4750

4851
stream.push(file);
4952
stream.push(jaFile);

0 commit comments

Comments
 (0)