0.3.5 • Published 6 years ago

reshape-eval-code v0.3.5

Weekly downloads
58
License
MIT
Repository
github
Last release
6 years ago

Reshape Eval Code

npm tests dependencies coverage

Evaluate all code nodes and transform to text nodes

Note: This project is in early development, and versioning is a little different. Read this for more details.

Installation

npm install reshape-eval-code -S

Usage

If you have your locals and want to resolve them early so that subsequent plugins can use them directly instead of running into code nodes, reshape eval code is your friend. It's a very simple plugin, you just feed it your locals and it will go through all code nodes and resolve them, then run whatever they produce through a parse so that even if you produce html with your code nodes it will still come out as a full reshape AST.

const reshape = require('reshape')
const expressions = require('reshape-expressions')
const evalCode = require('reshape-eval-code')

reshape({ plugins: [expressions(), evalCode({ foo: 'bar' })] })
  .process('<p>{{ foo }}</p>')
  .then((res) => {
    console.log(res.output()) // no locals required here! nice!
  })

License & Contributing

0.3.5

6 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago