Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0b14cca8cc | |||
f917820545 | |||
2246f101ba | |||
32d642bb70 |
4
dist/smarthbs.template.d.ts
vendored
4
dist/smarthbs.template.d.ts
vendored
@ -3,3 +3,7 @@
|
|||||||
* get a template for a file on disk
|
* get a template for a file on disk
|
||||||
*/
|
*/
|
||||||
export declare let getTemplateForFile: (filePathArg: string) => Promise<HandlebarsTemplateDelegate>;
|
export declare let getTemplateForFile: (filePathArg: string) => Promise<HandlebarsTemplateDelegate>;
|
||||||
|
/**
|
||||||
|
* get a template for string
|
||||||
|
*/
|
||||||
|
export declare let getTemplateForString: (fileStringArg: string) => Promise<HandlebarsTemplateDelegate>;
|
||||||
|
8
dist/smarthbs.template.js
vendored
8
dist/smarthbs.template.js
vendored
@ -16,4 +16,10 @@ exports.getTemplateForFile = (filePathArg) => __awaiter(this, void 0, void 0, fu
|
|||||||
let filePathAbsolute = plugins.path.resolve(filePathArg);
|
let filePathAbsolute = plugins.path.resolve(filePathArg);
|
||||||
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute));
|
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute));
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy50ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsOENBQTZDO0FBRTdDOztHQUVHO0FBQ1EsUUFBQSxrQkFBa0IsR0FBRyxDQUFPLFdBQW1CO0lBQ3hELElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDeEQsTUFBTSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUE7QUFDeEYsQ0FBQyxDQUFBLENBQUEifQ==
|
/**
|
||||||
|
* get a template for string
|
||||||
|
*/
|
||||||
|
exports.getTemplateForString = (fileStringArg) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return plugins.handlebars.compile(fileStringArg);
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy50ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsOENBQTZDO0FBRTdDOztHQUVHO0FBQ1EsUUFBQSxrQkFBa0IsR0FBRyxDQUFPLFdBQW1CO0lBQ3hELElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDeEQsTUFBTSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUE7QUFDeEYsQ0FBQyxDQUFBLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsb0JBQW9CLEdBQUcsQ0FBTyxhQUFxQjtJQUM1RCxNQUFNLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUE7QUFDbEQsQ0FBQyxDQUFBLENBQUEifQ==
|
43
docs/index.md
Normal file
43
docs/index.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# smarthbs
|
||||||
|
handlebars with better fs support
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
[](https://www.npmjs.com/package/smarthbs)
|
||||||
|
[](https://GitLab.com/pushrocks/smarthbs)
|
||||||
|
[](https://github.com/pushrocks/smarthbs)
|
||||||
|
[](https://pushrocks.gitlab.io/smarthbs/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://GitLab.com/pushrocks/smarthbs/commits/master)
|
||||||
|
[](https://GitLab.com/pushrocks/smarthbs/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/smarthbs)
|
||||||
|
[](https://david-dm.org/pushrocks/smarthbs)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smarthbs/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smarthbs)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> Note: Why did we decide against a class based architecture?
|
||||||
|
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.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import * as smarthbs from 'smarthbs'
|
||||||
|
|
||||||
|
// read all .hbs files in a directory and any child directories and use relative path as partial string identifier
|
||||||
|
smarthbs.registerPartialDir(testPartialDir)
|
||||||
|
|
||||||
|
// 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
|
||||||
|
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json')
|
||||||
|
```
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smarthbs",
|
"name": "smarthbs",
|
||||||
"version": "1.0.13",
|
"version": "1.0.15",
|
||||||
"description": "handlebars with better fs support",
|
"description": "handlebars with better fs support",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -7,3 +7,10 @@ export let getTemplateForFile = async (filePathArg: string) => {
|
|||||||
let filePathAbsolute = plugins.path.resolve(filePathArg)
|
let filePathAbsolute = plugins.path.resolve(filePathArg)
|
||||||
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute))
|
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a template for string
|
||||||
|
*/
|
||||||
|
export let getTemplateForString = async (fileStringArg: string) => {
|
||||||
|
return plugins.handlebars.compile(fileStringArg)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user