Skip to content

severian/filterify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filterify

Selectively run browserify transforms based on a filter

Installation

npm install filterify

API Usage

filterify exports a function that takes a config argument with two params:

  • transform: a browserify transform
  • filter: used to decide whether to execute the transform on given file. It can be one of:
    • a function that takes a filename and returns a boolean
    • a string that must occur verbatim in the filename
    • a regex that must match the filename
    • an array of valid filters

It returns a browserify transfom.

Example usage

To run envify with different environments for different parts of the project (where b is a browserify instance):

var filterify = require('filterify');
var envify = require('envify/custom');

b.transform(filterify({
  filter: '/prod_mode/',
  transform: envify({
    NODE_ENV: 'production'
  })
}));
b.transform(filterify({
  filter: '/dev_mode/',
  transform: envify({
    NODE_ENV: 'development'
  })
}));

CLI Usage

Not yet supported.

About

Selectively run browserify transforms based on a filter

Resources

Stars

Watchers

Forks

Packages

No packages published