laravel-mix-environments

laravel-mix-environments JS library on GitHub laravel-mix-environments JS library on npm Download laravel-mix-environments JS library

Adds mix.inDevelopment() & mix.inTest() to Laravel Mix.

Version 0.1.2 License MIT
laravel-mix-environments has no homepage
laravel-mix-environments JS library on GitHub
laravel-mix-environments JS library on npm
Download laravel-mix-environments JS library
Keywords
laravelwebpacklaravel elixirlaravel mixdevelopmenttestnode_envenviroments

laravel-mix-environments

Adds mix.inDevelopment() & mix.inTest() to Laravel Mix.

Introduction

laravel-mix-environments is a simple plugin that extends laravel-mix with 2 additional methods.

  • mix.inDevelopment() returns true when NODE_ENV is set to development.
  • mix.inTest() returns true when NODE_ENV is set to test.

Installation

$ npm install laravel-mix-environments

Usage

Inside your webpack.mix.js file, import laravel-mix-environments after importing laravel-mix and start using them.

const mix = require('laravel-mix');
const mixEnvironments = require('laravel-mix-environments');

if (mix.inDevelopment()) {
    // Add webpack configs for development environment here.
}

if (mix.inTest()) {
    // Add webpack configs for test environment here.
}

License

laravel-mix-environments by Yan Sern. This is an open source project released under the MIT License.

PS: I would love to know if you're using laravel-mix-environments. Tweet to me at @yansernio.