diff --git a/README.md b/README.md index 530565b..d4a1199 100644 --- a/README.md +++ b/README.md @@ -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 ====== diff --git a/src/index.js b/src/index.js index 267e986..dd67def 100644 --- a/src/index.js +++ b/src/index.js @@ -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(); };