https://github.com/jstransformers/jstransformer-reshape
Reshape support for JSTransformers.
https://github.com/jstransformers/jstransformer-reshape
Last synced: about 1 year ago
JSON representation
Reshape support for JSTransformers.
- Host: GitHub
- URL: https://github.com/jstransformers/jstransformer-reshape
- Owner: jstransformers
- License: mit
- Created: 2016-12-04T01:43:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-01T08:40:20.000Z (about 6 years ago)
- Last Synced: 2025-05-18T08:48:11.881Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://npmjs.com/jstransformer-reshape
- Size: 66.4 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# jstransformer-reshape
[reshape](https://reshape.ml/) support for [JSTransformers](http://github.com/jstransformers).
[](https://travis-ci.org/jstransformers/jstransformer-reshape)
[](https://codecov.io/gh/jstransformers/jstransformer-reshape)
[](http://david-dm.org/jstransformers/jstransformer-reshape)
[](https://www.npmjs.org/package/jstransformer-reshape)
## Installation
`npm install jstransformer-reshape`
> **Note:** Reshape requires node v6 or above.
## API
```js
const reshape = require('jstransformer')(require('jstransformer-reshape'))
const customElements = require('reshape-custom-elements')
const expressions = require('reshape-expressions')
const text = `
{{ name }}
`
const locals = {
name: 'caleb'
}
// pass an array of plugins
const options = { plugins: [customElements(), expressions()] }
reshape.renderAsync(text, options).then((result) => {
console.log(result.body)
})
//=> '
\nCaleb\n'
// or pass an object of plugins and settings
const options2 = {
plugins: {
customElements: { defaultTag: 'span' },
expressions: {}
}
}
reshape.renderAsync(text, options2, locals).then(function (result) {
console.log(result.body)
})
//=> '\nCaleb\n'
```
## License
MIT