1.1.1 • Published 7 years ago

reshape-components v1.1.1

Weekly downloads
16
License
-
Repository
github
Last release
7 years ago

Reshape Components

Build Status codecov Greenkeeper badge

Usage

Input:

foobar.html

<div class="g-foobar">
  <h1>This is a foobar called {{ props.title }}</h1>
  {{{ props.children }}}
  <h2>otherProp is {{ props.otherprop }}</h2>
</div>

main.html

<Import src="./foobar.html" as="FooBar"/>
<FooBar title="this is the title" otherProp="5">
  <p>Child Here</p>
</FooBar>

Processed as such:

const { readFileSync } = require('fs')
const reshape = require('reshape')
const components = require('reshape-components')
const expressions = require('reshape-expressions')

const main = readFileSync('main.html')

reshape({ plugins: [components(), expressions()] })
  .process(main)
  .then((result) => console.log(result.output()))

Results in:

<div class="g-foobar">
  <h1>This is a foobar called "this is the title"</h1>
  <p>Child Here</p>
  <h2>otherProp is 5</h2>
</div>

Installation

NPM

npm i -s reshape-components

Yarn

yarn add reshape-components

License: License: MIT

Copyright 2017 Caleb Eby

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago