Comparing version 0.5.1 to 0.5.2
22
bake.js
@@ -22,4 +22,5 @@ var fs = require("fs"), | ||
// Set values for `bakeDir` and `tplDir` | ||
var bakeDir = conf.directories.bake || "pub", | ||
// Set values for `inputDir`, `outputDir` and `tplDir` | ||
var inputDir = conf.directories.input || "pub", | ||
outputDir = conf.directories.output || "pub", | ||
tplDir = conf.directories.templates || "tpl"; | ||
@@ -33,6 +34,6 @@ | ||
// Status log | ||
console.log("Beginning to bake " + bakeDir + ".\n"); | ||
console.log("Beginning to bake " + inputDir + ".\n"); | ||
// Dive into the public directory | ||
dive(bakeDir, function(err, master) { | ||
dive(inputDir, function(err, master) { | ||
// Throw errors | ||
@@ -98,6 +99,11 @@ if (err) throw err; | ||
// Result's filename | ||
var resName = master.replace(fileExtPattern, | ||
"." + fileExt[masterExt]); | ||
if (prop._id == undefined) | ||
prop._id = master.replace(fileExtPattern, | ||
"." + fileExt[masterExt]); | ||
prop._id = resName.replace(inputDir, ""); | ||
// Add output dir | ||
resName = outputDir + prop._id; | ||
// Render ejs-template | ||
@@ -107,3 +113,3 @@ result = ejs.render(result, { locals: prop }); | ||
// Write contents | ||
fs.writeFile(prop._id, result, function(err) { | ||
fs.writeFile(resName, result, function(err) { | ||
// Throw errors | ||
@@ -117,3 +123,3 @@ if (err) throw err; | ||
// Log status on success | ||
console.log(" " + prop._id + " written.\n"); | ||
console.log(" " + resName + " written.\n"); | ||
@@ -120,0 +126,0 @@ // When file counter is zero |
@@ -5,3 +5,3 @@ { | ||
"tags": [ "ejs", "template" ], | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"author": "Paul Vorbach <paul@vorb.de> (http://vorb.de)", | ||
@@ -8,0 +8,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8230
106