Skip to content

Releases: gsandf/template-file

v5.0.1

20 Jan 14:42
Compare
Choose a tag to compare

πŸ› Fix

Fixed an issue with leading spacing for repeating sections. For example:

<!-- Example Template -->
<ul>
  {{#people}}
  <li>{{name}}</li>
  {{/people}}
</ul>

<!-- v5.0.0 -->
<ul>
    <li>Eric</li>
  <li>Anne</li>
</ul>

<!-- v5.0.1 -->
<ul>
  <li>Eric</li>
  <li>Anne</li>
</ul>

v5.0.0

20 Jan 13:36
Compare
Choose a tag to compare

✨ 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 renamed render
  • renderTemplateFile was renamed renderFile
  • 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

11 Jan 17:43
Compare
Choose a tag to compare

✨ add renderGlob and renderToFolder for programmatically rendering a glob to either a string or compile the output to a folder.

These are undocumented for now. They will be documented in the major version update coming soon.

v4.0.2

08 Jan 13:47
Compare
Choose a tag to compare

πŸ› fixes issue where project wouldn't work with versions of Node.js before v14 #45 (thanks @bingtimren!)

v4.0.1

11 Dec 01:27
Compare
Choose a tag to compare

πŸ› fixes the bin script so it runs in Node.js instead of a shell - #44

v4.0.0

10 Dec 21:03
Compare
Choose a tag to compare
  • ✨ rewrite project in TypeScript
  • πŸ”€ replace Travis CI with GitHub Actions
  • 🐭 add initial .editorconfig file
  • ⬆️ removes some dependencies, replaces some with newer versions

Dependency Upgrade

11 Jul 19:54
Compare
Choose a tag to compare
  • 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

v3.0.1...v3.1.0