Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

ember-cli-defeatureify

1.1.2 • Public • Published

ember-cli-defeatureify

Travis Build Status AppVeyor Build Status

Addon for Ember-CLI that allows you to defeatureify your code when building for production.

Installation

ember install:addon ember-cli-defeatureify

Usage

Specify features in your project's Brocfile.js:

var app = new EmberApp({
  defeatureify: {
    namespace: 'myNamespace',
    features: {
      "propertyBraceExpansion": true,
      "ember-metal-run-bind": true,
      "with-controller": true,
      "query-params-new": false,
      "string-humanize": false
    }
  }
})

When building in development, these features will be inlined in my-app.js, while they're only used for defeatureifying your code when building in production. The features are available to you in your application code under myNamespace.FEATURES.

To use the feature flags, you would wrap the code you want to enable like this:

if(myNamespace.FEATURES.isEnabled('propertyBraceExpansion')) {
  // Your code here
} else {
  // What to do if feature is disabled
}

Note: If you want to remove Ember debug statements, you will need to use Ember.default instead of just Ember in the debugStatements list.

Options

options.namespace

Namespace defaults to your application name from package.json, but you can specify your own through the namespace option.

The namespace is camelized if it contains dashes, underscores or spaces to make sure it's valid JavaScript and parseable by defeatureify.

Example:

'my-app-namespace'  // myAppNamespace
'app_namespace'     // appNamespace
'awesome namespace' // awesomeNamespace

See grunt-ember-defeatureify for more documentation of options.

Keywords

install

npm i ember-cli-defeatureify

Downloadsweekly downloads

270

version

1.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar