0.6.1 • Published 4 years ago

dust2jsx v0.6.1

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

dust2jsx

Create JSX code from Dust template

<header>
  {@Logo name="foo" shadow="true"/}
</header>

{?title}
  <h1 class="title">{title}</h1>
{/title}

{#images}
  <img src="{src}">
{/images}

➡️

<header>
  <Logo name="foo" shadow="true"/>
</header>

{title ?
  <h1 className="title">{title}</h1>
 : null}

{images.map(item =>
  <img src="{item.src}">
)}

Usage

const dust2jsx = require('dust2jsx');

dust2jsx('<input type="checkbox" {?checked}checked{/checked}/>');
// Outputs: <input type="checkbox" {checked ? 'checked' : ''}/>

Parameters

externals

(Boolean)

Outputs array of found referenced variables or Components. Optional. Default: false

dust2jsc('<header><Logo shadow="true"/></header><Foo bar />', { externals: true });
// Outputs: ['Logo', 'Foo']
0.6.1

4 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago