Permalink
Browse files

1.3.12: Patches.

  • Loading branch information...
1 parent 1284735 commit ce1b45bd92e8d2f256c0e038ae6a1f31e53eba01 @Deathspike committed Apr 17, 2013
Showing with 15 additions and 5 deletions.
  1. +8 −2 lib/client.js
  2. +7 −3 lib/index.js
View
@@ -252,11 +252,17 @@ var Gaikan = (function ($, container) {
// Render a view from file.
runtime.render = function (root, inputPartials, file) {
// Render a view.
- return templates[file](runtime, root, inputPartials);
+ return templates[file.replace(/\\/g, '/')](runtime, root, inputPartials);
};
// Return the runtime.
return runtime;
})();
// Return gaikan.
return gaikan;
-})($ === undefined ? null : $, '#content');
+})($ === undefined ? null : $, '#content');
+
+// Check if using as module.
+if (typeof module !== 'undefined') {
+ // Export Gaikan.
+ module.exports = Gaikan;
+}
View
@@ -119,7 +119,7 @@ module.exports.build = function (partial, isNotRoot) {
// Check if the directory does exist.
if (fs.existsSync(directory[i])) {
// Initialize the layout.
- var layout = path.join(directory[i], module.exports.options.layout) + (path.extname(module.exports.options.layout).length ? '' : '.' + module.exports.options.extension);
+ var layout = path.join(directory[i], module.exports.options.layout == null ? '' : module.exports.options.layout) + (path.extname(module.exports.options.layout).length ? '' : '.' + module.exports.options.extension);
// Initialize the files.
var files = fs.readdirSync(directory[i]);
// Iterate through each file in the directory.
@@ -136,7 +136,7 @@ module.exports.build = function (partial, isNotRoot) {
// Explain a template from file using the compiled function.
module.exports.explainFile(file, null, function (compiled) {
// Append the compiled template to the templates.
- templates += ',\'' + utils.inline(file) + '\': ' + compiled;
+ templates += ',\'' + utils.inline(file.replace(/\\/g, '/')) + '\': ' + compiled;
});
}
}
@@ -253,7 +253,11 @@ module.exports.explainFile = function (file, directory, cb) {
// Validate and set the callback
cb = cb === undefined ? console.log : cb;
// Validate and set the directory.
- directory = directory === undefined ? module.exports.options.directory : (Array.isArray(directory) ? directory : [directory]);
+ directory = directory ? directory : module.exports.options.directory;
+ // Validate and set the directory.
+ directory = (Array.isArray(directory) ? directory : [directory]);
+ // Unshift the root directory.
+ directory.unshift('');
// Validate and set the file name.
file = path.extname(file).length ? file : file + '.' + module.exports.options.extension;
// Iterate through each directory.

0 comments on commit ce1b45b

Please sign in to comment.