0.1.0 • Published 10 years ago

appendify v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

appendify

Browserify transform to append text at the end of CommonJS module files. This makes possible to inject code into modules whose path matches a given glob pattern.

Usage

This transform is designed to be used with the browserify API:

var appendify = require('appendify');

b.transform(appendify, {
  glob: './foo/bar/*.js',
  string: '\nconsole.log("This will be appended to modules matching the glob");'
});

Instead, you could also provide a function which returns the string to inject. The function will receive the file path to the module as parameter:

var appendify = require('appendify');

b.transform(appendify, {
  glob: './foo/bar/*.js',
  string: function(path) {
    return '\n// Module path: ' + path;
  }
});