1.0.0 • Published 5 years ago

nuxt-environment v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

Nuxt-Environment

Easily inject your environment into a nuxt project, and get information about what environment your application is running on.

Installation

npm install nuxt-environment

Usage

// nuxt.config.js
...
modules: [
  'nuxt-environment' // option A
],
stages: {
  'dev': {
    url: 'dev.site.url'
    apiUrl: 'https://httpstat.us'
  }
}
...
// nuxt.config.js
...
modules: [
  ['nuxt-environment', {
    stages: {
      'dev': {
        url: 'dev.site.url'
        apiUrl: 'https://httpstat.us'
      }
    }
  }]
]
...

Now, $env is available everywhere, and can tell you a lot about where your project is running if that influences your runtime decisions. The object it gives you looks like this

{
  client: {
    "browser": {
      "name": "Chrome",
      "version": "73.0.3683.86"
    },
    "os": {
      "name": "macOS",
      "version": "10.14.3"
    },
    "platform": {
      "type": "desktop",
      "vendor": "Apple"
    },
    "engine": {
      "name": "Blink"
    }
  },
  "stage": {
    url: 'dev.site.url'
    apiUrl: 'https://httpstat.us'
  }
}
1.0.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago