Skip to content

Latest commit

History

History
56 lines (38 loc) 路 2.05 KB

README.md

File metadata and controls

56 lines (38 loc) 路 2.05 KB

The project has moved to the Nuxt-Community 馃殌 https://github.com/nuxt-community/dotenv-module

nuxtjs-dotenv-module

npm (scoped with tag) npm CircleCI Codecov Dependencies

js-standard-style

A nuxt.js module that loads your .env file into your context options

馃摉 Release Notes

Features

The module loads variables from your .env file directly into your nuxt.js application context and process.env.

Setup

  • Add nuxtjs-dotenv-module dependency using yarn or npm to your project
  • Add nuxtjs-dotenv-module to modules section of nuxt.config.js
{
  modules: [
    // Simple usage
    'nuxtjs-dotenv-module',

    // With options
    ['nuxtjs-dotenv-module', { /* module options */ }],
 ]
}

Usage

After creating your .env file in the project root, simply run your usual npm run dev. The variable inside the .env file will be added to the context (context.env) and process (process.env)

if for some reason you want to restrict what's accessible into the context, you can can pass to the module options an only array with the keys you want to allow.

{
  modules: [
    ['nuxtjs-dotenv-module', {only: ['some_key']}],
  ]
}

License

MIT License

Copyright (c) Julien Tant julien@craftyx.fr