2019-02-17 16:02:35 +00:00
|
|
|
# @pushrocks/smarthbs
|
2017-02-19 03:12:17 +00:00
|
|
|
handlebars with better fs support
|
|
|
|
|
2019-02-17 16:02:35 +00:00
|
|
|
## Availabililty and Links
|
|
|
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smarthbs)
|
|
|
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/smarthbs)
|
|
|
|
* [github.com (source mirror)](https://github.com/pushrocks/smarthbs)
|
|
|
|
* [docs (typedoc)](https://pushrocks.gitlab.io/smarthbs/)
|
2017-02-19 03:12:17 +00:00
|
|
|
|
|
|
|
## Status for master
|
2019-02-17 16:02:35 +00:00
|
|
|
[![build status](https://gitlab.com/pushrocks/smarthbs/badges/master/build.svg)](https://gitlab.com/pushrocks/smarthbs/commits/master)
|
|
|
|
[![coverage report](https://gitlab.com/pushrocks/smarthbs/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smarthbs/commits/master)
|
|
|
|
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smarthbs.svg)](https://www.npmjs.com/package/@pushrocks/smarthbs)
|
|
|
|
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smarthbs/badge.svg)](https://snyk.io/test/npm/@pushrocks/smarthbs)
|
|
|
|
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
|
|
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
2017-02-19 03:12:17 +00:00
|
|
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
|
|
|
|
|
|
|
## Usage
|
2018-08-27 21:04:15 +00:00
|
|
|
|
2017-02-19 03:12:17 +00:00
|
|
|
> Note: Why did we decide against a class based architecture?
|
2018-08-27 21:04:15 +00:00
|
|
|
> Easy: handlebars.js is already pretty determined how things are handled internally, namely a global partial template registry
|
|
|
|
> It doesn't make sense to then introduce a scoped partial template approach.
|
2017-02-19 03:12:17 +00:00
|
|
|
|
|
|
|
```javascript
|
2018-08-27 21:04:15 +00:00
|
|
|
import * as smarthbs from 'smarthbs';
|
2017-02-19 03:12:17 +00:00
|
|
|
|
|
|
|
// read all .hbs files in a directory and any child directories and use relative path as partial string identifier
|
2018-08-27 21:04:15 +00:00
|
|
|
smarthbs.registerPartialDir(testPartialDir);
|
2017-02-19 03:12:17 +00:00
|
|
|
|
|
|
|
// read all .hbs files in a particular directory and level, output them to a destination and specify a .json file to read any referenced data
|
2018-08-27 21:04:15 +00:00
|
|
|
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json');
|
2017-02-19 03:12:17 +00:00
|
|
|
```
|
|
|
|
|
2019-02-17 16:02:35 +00:00
|
|
|
For further information read the linked docs at the top of this readme.
|
|
|
|
|
2017-02-26 01:10:54 +00:00
|
|
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
2019-02-17 16:02:35 +00:00
|
|
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
2017-02-26 01:10:54 +00:00
|
|
|
|
2019-02-17 16:02:35 +00:00
|
|
|
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
|