npm

Need private packages and team management tools?Check out npm Orgs. »

vue-config-manager

0.2.2 • Public • Published

Vue Configuration Manager

A configuration manager for Vue



npm version

NPM

npm install vue-config-manager

Basic usage

This example will add a debug variable to the config manager

Vue.use(VueConfigManager, {
  defaults: {
    debug: true,
    api: {
      base: 'http://graph.facebook.com/'
    }
  }
})

You can retrieve this variable inside a Vue component

Vue.component('example', {
  mounted () {
    const debug = this.$config('debug')
    const base = this.$config('api.base')
  }
})

Environment specifics

When you need different configuration for a specific environment

Vue.use(VueConfigManager, {
  defaults: {
    debug: true
  },
 
  environment: {
    debug: false
  }
})

However, if you're not running in a server environment you can also get desired configuration based on the hostname of your app.

Vue.use(VueConfigManager, {
  defaults: {
    debug: true
  },
 
  hosts: {
    'localhost': {
      debug: false
    }
  }
})

Development Setup

# install deps
npm install
 
# build dist files
npm run build
 
# serve examples at localhost:8080
npm run dev
 
# run all tests
npm test

install

npm i vue-config-manager

Downloadsweekly downloads

15

version

0.2.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability