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

[feat]: with template #44

Closed
Shyam-Chen opened this issue Mar 31, 2017 · 2 comments
Closed

[feat]: with template #44

Shyam-Chen opened this issue Mar 31, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@Shyam-Chen
Copy link

Shyam-Chen commented Mar 31, 2017

<each loop="item in [['/', 'Home'], ['/about', 'About'], ['/contact', 'Contact']]">
  <a class="mdl-navigation__link" href="{{ item[0] }}">{{ item[1] }}</a>
</each>

use template

import template from 'foo.html';

document.querySelector('#ex').innerHTML = template({
  List: [['/', 'Home'], ['/about', 'About'], ['/contact', 'Contact']]
});
<each loop="item in ${ _.List }">
  <a class="mdl-navigation__link" href="{{ item[0] }}">{{ item[1] }}</a>
</each>

Output:

<each loop="item in /, Home, /about, About, /contact, Contact">
  <a class="mdl-navigation__link" href="{{ item[0] }}">{{ item[1] }}</a>
</each>
@jescalan
Copy link
Contributor

jescalan commented Mar 31, 2017

Posthtml's templating method will not generate client-side templates with posthtml-expressions, it is only compatible with interpolated strings like <p>Hello ${planet}</p>.

Currently the only way to get client-side templates with plugins is to have the code generator output a function, which is only possible at the moment using the reshape version. Although hopefully this functionality will also be coming to posthtml soon!

@Scrum Scrum self-assigned this Dec 13, 2017
@Scrum Scrum changed the title with template [feat]: with template Jan 12, 2018
@Scrum Scrum added the feature label Jan 12, 2018
@Scrum Scrum added this to the v1.2.0 milestone Jan 12, 2018
@Scrum Scrum modified the milestones: v1.2.0, 1.3.0 Nov 13, 2019
@Scrum Scrum modified the milestones: 1.3.0, 1.5.0 May 19, 2020
@Shyam-Chen
Copy link
Author

duplicate of #54

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

No branches or pull requests

3 participants