Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request #158

Closed
vitaliiznak opened this issue May 13, 2015 · 5 comments
Closed

Feature request #158

vitaliiznak opened this issue May 13, 2015 · 5 comments

Comments

@vitaliiznak
Copy link

Hello, I am trying to use the same template on client and server side, and because of that I want to add some feature to template parser. I want to escape some template to be parsing.
E.x

<script type="text/plain" id="commentTremplate">
<span>it.comment.author</span> this part will be parsed on server side
[[ //this part will not be parsed on server side
........
<div>
it.comment.content
<div>
........
]]//
<script>

than I can add some trigger like parse only inside or outside of [[ ]],

@btpoe
Copy link

btpoe commented Oct 19, 2015

My suggestion would be to change your server-side templateOptions to evaluate on a different set of handlebars (ie: <? and ?>).

I think this would help a lot for someone coming in behind you who is trying to figure out why their server-side variable isn't being evaluated.

Another solution would be to not pass your client-side templates through doT on the server. I realize some people use doT to render their view entirely, so that might not be an option for you, but I think it's a valid solution. I recommend the first option because it doesn't force you to change your workflow quite as much.

@dan-silk-discovery
Copy link

dan-silk-discovery commented Apr 19, 2016

Actually, all you need to do is set some boolean value like "isServer" and then wrap the sections you need for the server with [[? it.isServer]] ... [[?]] and wrap the sections you need for the client with [[? !it.isServer ]] ... [[?]]

@houd1ni
Copy link

houd1ni commented Apr 20, 2016

feel free to reopen #191 due to maintain issues with this fork

@epoberezkin
Copy link
Collaborator

@signumcode I think it is answered by @btpoe. Please reopen/clarify otherwise.

@epoberezkin
Copy link
Collaborator

Can be added to doT 101 #205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants