graspify2

1.0.1 • Public • Published

graspify2

Browserify transform to make source code replacements using grasp.

This is a clone from graspify@2.0.3, which was broken.

Installing

$ npm install --save-dev graspify2

package.json

Replace DEBUG with false

{
  "browserify": {
    "transform":[
      ["graspify2", { "patterns": ["squery", "#DEBUG", "false"] }]
    ]
  }
}

API

Also can be used programmatically:

var browserify = require('browserify');
var b = browserify('./entry.js');
var graspify = require('graspify2');

b.transform(graspify, {
    patterns: [
      ["squery", "#myVar", "myVariable"],
      ["equery", "__ + __", "{{.r}} + {{.l}}"],

      ["equery", "require($module)", function(){
        return "require('stub')"
      }]
    ]
})

options

patterns

Type: Array

Each replacing rule is denoted by a triplet. If more than one rules specified, .patterns should be something like the example in API.

Package Sidebar

Install

npm i graspify2

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • zoubin