Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fusepilot/templaid
Declarative filesystem based template rendering
https://github.com/fusepilot/templaid
Last synced: about 1 month ago
JSON representation
Declarative filesystem based template rendering
- Host: GitHub
- URL: https://github.com/fusepilot/templaid
- Owner: fusepilot
- Created: 2017-12-13T10:02:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T08:21:16.000Z (about 2 years ago)
- Last Synced: 2024-10-31T18:57:39.714Z (about 2 months ago)
- Language: TypeScript
- Size: 196 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Templaid
Declarative filesystem based template rendering with [handlebars.js](https://github.com/wycats/handlebars.js).
### Install
```sh
yarn add templaid
```## Example
Given the following template folder hierarchy:
```
path/to/template
└─ {{project.name}}
├─ {{project.name}}.md
├─ file001.txt
└─ assets
├─ {{project.name}}.ae
└─ {{project.name}}.psd
```Will render the following hierarchy:
```
path/to/destination
└─ MyProjectName
├─ MyProjectName.md
├─ file001.txt
└─ assets
├─ MyProjectName.ae
└─ MyProjectName.psd
```With this code:
```js
renderTemplate({
templatePath: 'path/to/template',
destinationPath: 'path/to/destination',
data: {
project: {
name: 'MyProjectName'
}
}
})
```## Template files
Files suffixed with `.template` will be treated as templates. For example, if a
markdown file named `{{project.name}}Readme.md.template` with the following content:```markdown
### {{project.name}} : {{project.version}}{{project.description}}
```With the data:
```json
{
"name": "MyProjectName",
"version": "1.0.0",
"description": "A description of the project."
}
```Will create a file named `MyProjectNameReadme.md` with its contents being:
```markdown
### MyProject : 1.0.0A description of the project.
```## Todo
* Document all features ( partials, macros )
* Cover more use cases in tests