Releases: gsandf/template-file
v5.0.1
v5.0.0
β¨ Additions
Can now render lists of items using section tags {{#example}}
and {{/example}}
. Empty lists and falsy values aren't rendered:
const template = `
{{#stooges}}
<b>{{name}}</b>
{{/stooges}}
`;
const data = {
stooges: [
{ name: "Moe" },
{ name: "Larry" },
{ name: "Curly" }
]
}
render(template, data);
//Β» <b>Moe</b>
//Β» <b>Larry</b>
//Β» <b>Curly</b>
Added a "Templates" section to the documentation. Before, it was pretty simple because this only replaced one tag: {{example}}
. With the addition of the section tag (and potentially more in the future), this needed to be documented.
Added functions renderGlob
and renderToFolder
for programmatically rendering multiple files to either a string or compiling them to a folder. They were in the last v4 release, but were undocumented. renderGlob
takes a glob of files to render and calls a function with the filename and rendered contents. renderToFolder
is basically a programmatic version of the CLI that renders files matching the input glob and writes them to a destination folder (returning nothing).
Can now handle the edge-case where an object property has a dot in its name:
import { render } from 'template-file';
const data = { 'with.dot': 'yep' };
render('Does this work? {{with.dot}}', data);
π₯ Breaking Changes
renderString
was renamedrender
renderTemplateFile
was renamedrenderFile
- Object properties with a dot now are resolved.
π Known Issues
The output spacing isn't exactly what I want. I figured it's not a huge deal for now, but here's an example:
<!-- Example Template -->
<ul>
{{#people}}
<li>{{name}}</li>
{{/people}}
</ul>
<!-- Wanted -->
<ul>
<li>Eric</li>
<li>Anne</li>
</ul>
<!-- Actual -->
<ul>
<li>Eric</li>
<li>Anne</li>
</ul>
v4.1.0
v4.0.2
v4.0.1
v4.0.0
Dependency Upgrade
- Merge pull request #32 from gsandf/upgrade-deps 7aa2441
- upgraded deps feb0de7
- Merge pull request #31 from gsandf/dependabot/npm_and_yarn/lodash.merge-4.6.2 8b77b29
- β¬οΈ Bump lodash.merge from 4.6.0 to 4.6.2 eb95823
- chore(package): update eslint to version 5.0.0 7d025f2
- Merge pull request #23 from gsandf/greenkeeper/ava-0.25.0 827d3f8
- chore(package): update ava to version 0.25.0 e46dcd6
- Merge pull request #22 from gsandf/greenkeeper/ava-0.24.0 f581ef9
- chore(package): update ava to version 0.24.0 c2cff36
- Merge pull request #20 from gsandf/greenkeeper/eslint-config-gsandf-1.0.0 bc68e84
- chore(package): update eslint-config-gsandf to version 1.0.0 9abb159
- Merge pull request #19 from gsandf/greenkeeper/ava-0.23.0 2dc544e
- chore(package): update ava to version 0.23.0 5fd9aee
- Merge pull request #18 from gsandf/greenkeeper/eslint-config-gsandf-0.4.0 c736031
- chore(package): update eslint-config-gsandf to version 0.4.0 88aa5f7
- Merge pull request #17 from gsandf/gsandf-linting db53e80
- π¨ move to using GS&F code style be7374c