Templates and mixins #53

Open
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants

forste commented Jun 11, 2012

Added support for templates and mixins. See Readme for more.

Owner

tj commented Jun 11, 2012

looks decent I'll go through and review!

@@ -18,6 +18,8 @@ Embedded JavaScript templates.
* Filter support for designer-friendly templates
* Client-side support
* Newline slurping with `<% code -%>` or `<% -%>` or `<%= code -%>` or `<%- code -%>`
+ * Templating with <%+ template.html %> and <%~ argumentName %>
@tj

tj Jun 11, 2012

Owner

maybe some others will chime in here, but I would personally rather see these named instead of introducing a bunch more chars to remember. Maybe <% extend template.html %> and <% block name %>

@forste

forste Jun 11, 2012

thought about that as well. for consistency I picked the chars

@oldcookie

oldcookie Jul 13, 2012

Chiming in. I personally prefer extend and block as well, more expressive.

@@ -18,6 +18,8 @@ Embedded JavaScript templates.
* Filter support for designer-friendly templates
* Client-side support
* Newline slurping with `<% code -%>` or `<% -%>` or `<%= code -%>` or `<%- code -%>`
+ * Templating with <%+ template.html %> and <%~ argumentName %>
+ * Mixins with <%# mixin.html %>
@tj

tj Jun 11, 2012

Owner

maybe <% include foo.html %> here too

+ //insert
+
+
+
@tj

tj Jun 11, 2012

Owner

what's all this?

@forste

forste Jun 11, 2012

good question, should not be in here

+ }
+
+ //insert mixings
+ var mixinStartSym = '<%#',
@tj

tj Jun 11, 2012

Owner

we shouldn't hard-code the <% %> delimiters since devs can change them to {{}} etc

@forste

forste Jun 11, 2012

forgot about changing that, will do

+ );
+ if(options.debug) {
+ console.log('strBeforeMixin=(\n'+strBeforeMixin+'\n)');
+ }
@tj

tj Jun 11, 2012

Owner

all the debug stuff can go once we have test cov

@forste

forste Jun 11, 2012

I guess I will leave it for now

forste commented Jun 11, 2012

let me know if characters [+~#] or strings (which ones) are prefered. I can fix the rest then and re-request

forste commented Jun 11, 2012

additionally I thought about allowing compile templates and mixins so that they don't have to be composed every request. compilation would be independent from caching mechanisms

rummik commented Oct 19, 2012

@forste From the way things read, strings are the preferred

TimothyGu added a commit to TimothyGu/ejs-tj that referenced this pull request Feb 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment