Drulac / template-literal

fastest, smallest and simplest template engine, using JS's literal template feature
GNU General Public License v3.0
46 stars 2 forks source link

Does this support if conditions for content blocks? #5

Closed IonicaBizau closed 5 years ago

IonicaBizau commented 6 years ago
if true
  <h1>Fooo</h1>
  <p>Some content here</p>
else 
  <h1>Bar</h1>
  <p>Some different content here</p>

From the quick view, I guess that's not possible, but which is the right way to do this?

Spongman commented 5 years ago

this works:

${
  (true) ? `
    <h1>Fooo</h1>
    <p>Some content here</p>
  ` : `
    <h1>Bar</h1>
    <p>Some different content here</p>
  `
}
IonicaBizau commented 5 years ago

Thanks!