GithubHelp home page GithubHelp logo

krisselden / ember-cli-defeatureify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jkarsrud/ember-cli-defeatureify

0.0 2.0 0.0 307 KB

Ember-CLI addon to defeatureify your apps

License: MIT License

JavaScript 100.00%

ember-cli-defeatureify's Introduction

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.

ember-cli-defeatureify's People

Contributors

ember-tomster avatar jkarsrud avatar rwjblue avatar sivakumar-kailasam avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.