Please sign in to comment.
Handle a new `.tpl.jade` file extension
Putting each template in its own separate file and naming the file after the template it contains is becoming a followed pattern among Meteor developers. See for instance this article from Josh Owens: http://joshowens.me/how-to-organize-your-meteor-js-app/ But as it stands today, this pattern doesn't respect the “don't repeat yourself” (DRY) philosophy. Indeed you have to wrap your template in a `<template name="myTemplate>` tag and saving it in a `myTemplate.html` file, effectively writing the name of the template twice. If those two names doesn't match Meteor will consider the name of the `<template>` tag and will ignore the file name. So if you follow this pattern you have to take care of keeping the file name and the template tag name in sync (manually). This commit solve the problem presented above for jade using a new file extension, namely `.tpl.jade`. With this extension you can only define one template per file and you don't need to wrap your template in a tag. The template will be named after the file name. We handle special `head.tpl.jade` and `body.tpl.jade` templates as expected. Of course the `.jade` extension is still here and you can use it along the new one, for instance for rapid prototyping (with several templates in the same file) or for different parts of the apps ( sometimes it makes sense to define a group of templates in the same file).
- Loading branch information...
Showing with 82 additions and 28 deletions.
|@@ -0,0 +1,2 @@|