Permalink
Browse files

Finally made it to Blade 3.0.0 stable

`body.blade` templates are now dynamic (fixes #140)
  • Loading branch information...
1 parent 8b42239 commit 1ab53049fd26952edcd72ef1e99750104c26a892 @bminer committed Mar 12, 2013
Showing with 19 additions and 11 deletions.
  1. +17 −9 meteor/package.js
  2. +1 −1 package.json
  3. +1 −1 smart.json
View
@@ -61,20 +61,19 @@ Package.register_extension("blade", function(bundle, srcPath, servePath, where)
'includeSource': true //default to true for debugging
}, function(err, tmpl) {
if(err) throw err;
- if(templateName == "head" || templateName == "body")
+ if(templateName == "head")
tmpl({}, function(err, html) {
//This should happen synchronously due to compile options set above
if(err) throw err;
bundle.add_resource({
- type: templateName, //either "head" or "body"
+ type: templateName,
data: html,
where: where
});
});
- bundle.add_resource({
- type: 'js',
- path: "/views/" + templateName + ".js", //This can be changed to whatever
- data: new Buffer("blade._cachedViews[" +
+ else
+ {
+ var data = "blade._cachedViews[" +
//just put the template itself in blade._cachedViews
JSON.stringify(templateName + ".blade") + "]=" + tmpl.toString() + ";" +
//define a template with the proper name
@@ -110,9 +109,18 @@ Package.register_extension("blade", function(bundle, srcPath, servePath, where)
//so... by here, we can just return `ret`, and everything works okay
"return ret;" +
"}" +
- ");"),
- where: where
- });
+ ");";
+ if(templateName == "body")
+ data += "Meteor.startup(function(){" +
+ "document.body.appendChild(Spark.render(Template.body));" +
+ "});"
+ bundle.add_resource({
+ type: 'js',
+ path: "/views/" + templateName + ".js", //This can be changed to whatever
+ data: data,
+ where: where
+ });
+ }
});
});
View
@@ -15,7 +15,7 @@
"live binding",
"meteor"
],
- "version": "3.0.0rc5",
+ "version": "3.0.0",
"homepage": "https://github.com/bminer/node-blade",
"repository": {
"type": "git",
View
@@ -3,7 +3,7 @@
"author": "Blake Miner <miner.blake@gmail.com> (http://www.blakeminer.com/)",
"description": "Blade - HTML Template Compiler, inspired by Jade & Haml",
"homepage": "https://github.com/bminer/node-blade",
- "version": "3.0.0rc5",
+ "version": "3.0.0",
"git": "https://github.com/bminer/node-blade.git",
"packages": {
}

0 comments on commit 1ab5304

Please sign in to comment.