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

Dependencies (0)

    Dev Dependencies (35)

    Package Sidebar

    Install

    npm i vue-config-manager

    Weekly Downloads

    22

    Version

    0.2.2

    License

    MIT

    Last publish

    Collaborators

    • jonaskuiler