jstransformer-reshape

1.0.0 • Public • Published

jstransformer-reshape

reshape support for JSTransformers.

Build Status Coverage Status Dependency Status Greenkeeper badge NPM version

Installation

npm install jstransformer-reshape

Note: Reshape requires node v6 or above.

API

const reshape = require('jstransformer')(require('jstransformer-reshape'))
const customElements = require('reshape-custom-elements')
const expressions = require('reshape-expressions')
 
const text = `
<my-component>
  <my-text class="text">{{ name }}</my-text>
</my-component>
`
 
const locals = {
  name: 'caleb'
}
 
// pass an array of plugins
const options = { plugins: [customElements(), expressions()] }
 
reshape.renderAsync(text, options).then((result) => {
  console.log(result.body)
})
//=> '<div class="my-component">\n<div class="text my-text">Caleb</div>\n</div>'
 
// 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)
})
//=> '<span class="my-component">\n<span class="text my-text">Caleb</span>\n</span>'

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i jstransformer-reshape

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

5.38 kB

Total Files

5

Last publish

Collaborators

  • calebeby
  • forbeslindesay
  • hemanth
  • robloach
  • stoeffel
  • timothygu