Skip to content

Generates an angular module from a json config file

Notifications You must be signed in to change notification settings

pankratios/ng-config-brunch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-config-brunch

Generates an angular module from a json config file

Usage

Install the plugin via npm with npm install [email protected]:pankratios/ng-config-brunch.git.

Options

Import external data through the imports section.

{
  ...
  plugins: {
    ngconfig: {
      imports: [
        './package.json',
        './bower.json'
      ]
    }
  }
}

The imported data can be accessed with {{...}} notation.

{
  "packageVersion": "{{=it.package.version}}"
  "bowerVersion": "{{=it.bower.version}}"
}

Configuration file structure

Configurations can be overriden per environment, development is the default.

Example

*.conf.json

{
  "moduleName": "myApp.config",
  "values": {
    "appName": "App name is {{=it.bower.name}}",
  },
  "constants": {
    "appVersion": "version {{=it.package.version}}",
    "requestTimeout": 3000
  },
  "overrides": {
    "production": {
      "constants": {
        "requestTimeout": 1000
      }
    }
  }
}

Generated module

development env

angular
  .module("myApp.config", [])
  .constant("appVersion", "version 1.0.9")
  .value("appName", "App name is angular-config-example")
  .constant("requestTimeout", 3000)

production env

angular
  .module("myApp.config", [])
  ...
  .constant("requestTimeout", 1000)

About

Generates an angular module from a json config file

Resources

Stars

Watchers

Forks

Packages

No packages published