An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# jstransformer-reshape

[reshape](https://reshape.ml/) support for [JSTransformers](http://github.com/jstransformers).

[![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-reshape/master.svg)](https://travis-ci.org/jstransformers/jstransformer-reshape)
[![Coverage Status](https://img.shields.io/codecov/c/github/jstransformers/jstransformer-reshape/master.svg)](https://codecov.io/gh/jstransformers/jstransformer-reshape)
[![Dependency Status](https://img.shields.io/david/jstransformers/jstransformer-reshape/master.svg)](http://david-dm.org/jstransformers/jstransformer-reshape)
[![NPM version](https://img.shields.io/npm/v/jstransformer-reshape.svg)](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)
})
//=> '

\n
Caleb
\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