laravel-elixir-env

1.0.0 • Public • Published

laravel-elixir-env

NPM version

Use .env variables in your Javascript files with Webpack in Laravel Elixir.

Read the story on Medium

Installation

npm install laravel-elixir-env --save

or

yarn add laravel-elixir-env

Requirements

  • Laravel Elixir
  • Laravel-elixir-webpack-official

Usage

Require the package in your gulpfile, after Elixir:

const elixir = require('laravel-elixir');
//...
require('laravel-elixir-env');
//...

Now you can access your variables in all the scripts that are packed with Webpack like so:

process.env.VAR_NAME

Optionally, you can set the path of the default .env file or set any dotenv configuration option like so:

require('laravel-elixir-env').config({ path: 'my-folder/.env' });

Be careful with sensitive variables that can hold private information. Don't forget to recompile on all your environments.

If you like this, please star on GitHub!

Issues and Pull Requests welcome.

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

Appstract is a small team from The Netherlands. <3 Laravel, Vue and other awesome tools.

Buy Us A Beer

Would be awesome if you would buy us a beer! Or a lot of beer :)

License

Laravel-elixir-env is licensed under The MIT License (MIT).

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    12
    • latest

Version History

Package Sidebar

Install

npm i laravel-elixir-env

Weekly Downloads

19

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gizburdt
  • ovanschie