Skip to content

Commit

Permalink
removed oven and adapted app.js to work with it
Browse files Browse the repository at this point in the history
  • Loading branch information
thlorenz committed Aug 25, 2012
1 parent 212c94b commit 20c2363
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function renderSite(err) {
}
};

var rendered = hotplates.oven.index(ctx);
var rendered = handlebars.templates['index'](ctx);
fs.writeFileSync('./index.html', rendered);

exec('open ' + './index.html');
Expand Down
17 changes: 7 additions & 10 deletions hotplates.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var fs = require('fs')
;

function HotPlates () {
this.oven = { };
handlebars.templates = { };
this.templateFiles = [ ];
this.partialFiles = [ ];
this.watchedDirectories = { };
Expand Down Expand Up @@ -63,13 +63,14 @@ HotPlates.prototype.process = function (opts, watch, processFile, done) {
};

HotPlates.prototype.processTemplate = function (file, plate) {
var plateName = utl.plateNameFrom(file.name)
, namespaced = utl.namespace(file.parentDir, this.oven)
, namespacedPlateName = namespaced.path.length > 0 ? namespaced.path + '.' + plateName : plateName;
var plateName = utl.plateNameFrom(file.name)
, namespaces = utl.folderParts(file.parentDir)
, fullName = namespaces.length === 0 ? plateName : namespaces.concat(plateName).join('.')
;

namespaced.root[plateName] = handlebars.compile(plate);
handlebars.templates[fullName] = handlebars.compile(plate);

this.emit('templateCompiled', file, namespacedPlateName, plate);
this.emit('templateCompiled', file, fullName, plate);
};

HotPlates.prototype.processPartial = function (file, partial) {
Expand Down Expand Up @@ -147,9 +148,6 @@ HotPlates.prototype.heat = function (opts, hot) {
HotPlates.prototype.burn = function () {
var self = this;

Object.keys(self.oven).forEach(function (key) {
delete self.oven[key];
});
Object.keys(handlebars.templates).forEach(function (key) {
delete handlebars.templates[key];
});
Expand All @@ -173,5 +171,4 @@ module.exports = {
heat : function () { hp.heat.apply(hp, arguments); return this; }
, burn : function () { hp.burn.apply(hp, arguments); return this; }
, on : function () { hp.on.apply(hp, arguments); return this; }
, oven : hp.oven
};

0 comments on commit 20c2363

Please sign in to comment.