evalify

2.1.0 • Public • Published

evalify

browserify transform to eval modules before exporting.

npm i --save evalify

stolen from mmckegg/web-audio-school.

example

given a module:

// cats.js
var catNames = require('cat-names')
 
var cats = []
for (var i = 0; i < 10; i++) {
  cats.push(catNames.random())
}
 
module.exports = cats

compile using browserify using -t [ evalify -f '**/cats.js' ]

browserify ./cats.js -t [ evalify -f '**/cats.js' ]

cats.js file is transformed to

module.exports = ["Cali","Rascal","Jack","Jasmine","Kitty","Nala","Jack","Cookie","Jack","Buster"]

usage

evalify is a browserify transform with the following options:

  • files (f): a list of minimatch paths to determine whether to evaluate a given file.

using the browserify cli:

browserify entry.js -t [ evalify -f '**/to-eval.js' ]

using your package.json:

"browserify": {
  "transform": [
    ["evalify", { files: [ "**/to-eval.js" ] } ]
  ]
}

license

ISC

Package Sidebar

Install

npm i evalify

Weekly Downloads

11

Version

2.1.0

License

ISC

Last publish

Collaborators

  • ahdinosaur