Vue config manager

A Vue configuration and environment manager

Version: 0.2.2 Updated: 03/10/2017

By: jonaskuiler License: MIT

Downloads Last 30 Days: 207

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
Categories: Vue js