Skip to content

Commit

Permalink
Merge pull request #5 from dbashford/adding-build-deafeaturing
Browse files Browse the repository at this point in the history
Allow build v watch defeaturing
  • Loading branch information
peluja1012 committed Apr 11, 2015
2 parents 1445c68 + 5365a23 commit fdd40f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ If both `master` and `child` are present, `defeature` will perform a smart merge

`mimosa` will remove features when your run `mimosa watch` or `mimosa build`.

## `build` v `watch` exclusion

A feature called `mimosa-build-exclude` is automatically recognized by mimosa-defeature. This included feature allows for excluding features based on whether Mimosa is running a `watch` or a `build`. When running a `build`, all code using the `mimosa-build-exclude` feature flag will be removed/commented.

Default Config
======

Expand Down
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ var _prepareFeatures = function(mimosaConfig, options, next) {
mimosaConfig.defeature.includedFeatures = includedFeatures;
mimosaConfig.defeature.excludedFeatures = excludedFeatures;

// when running a build, add feature that
// allows defeaturing to be build v watch specific
// Allows for leaving things in for dev that need removing for build
if (mimosaConfig.isBuild) {
excludedFeatures.push("mimosa-build-exclude");
} else {
includedFeatures.push("mimosa-build-exclude");
}

next();
};

Expand Down

0 comments on commit fdd40f7

Please sign in to comment.