Reshape

Reshape is a tool for transforming static html with javascript plugins.
Think of it like postcss or babel, but for html.

Source on Github
<section>
  <p>Hi, I’m {{ name }}!</p>
  <p md>look, **markdown**!</p>
</section>
const reshape = require('reshape')
const expr = require('reshape-expressions')
const content = require('reshape-content')
const marked = require('marked')

reshape({ plugins: [ expr(), content({ md: marked }) ] }).process(htmlInput) .then((res) => { res.output({ name: 'reshape' }) })
<section>
  <p>Hi, I’m reshape!</p>
  <p>look, <strong>markdown<strong>!</p>
</section>

Try It Out!

const reshape = require('reshape') const standard = require('reshape-standard') const html = `doctype html head title testing! body p hello {{ name }}! ul each(loop='number of [1,2,3]') li {{ number }} ` return await reshape(standard()) .process(html) .then((res) => res.output({ name: 'world' }))

We've Got Features for Days!

Getting Started

Reshape is written in node.js and can be used with node v6 or higher. You can install it through npm as such:

npm install reshape

Reshape has a very simple API. Just call it as a function, passing in optional filename, plugins, parser, and/or generator, call .process(html) with some html, and it will return a promise containing the output, just like the example at the top of this page. For more details, check out the readme on github.