layflags / substitutify

Browserify transform to replace placeholders with infos from `package.json`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

substitutify

Browserify transform to replace placeholders with infos from package.json.

Inspired by browserify-versionify.

Usage

From package.json:

{
  ...
  "browserify": {
    "transform": [
      ["sustitutify", {
        "__VERSION__": "version",
        "__NAME__": "name"
      }],
      ...
    ],
    ...
  },
  ...
}

From Node.js:

browserify().transform('substitutify', {
  '__VERSION__': 'version',
  '__NAME__': 'name'
});

You can also provide a filter property to whitelist files to apply the transform to (e.g. filter: /\.js$/).

About

Browserify transform to replace placeholders with infos from `package.json`


Languages

Language:JavaScript 100.0%