laravel-mix-environments

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


Keywords
laravel, webpack, laravel elixir, laravel mix, development, test, node_env, enviroments
License
MIT
Install
npm install laravel-mix-environments@0.1.1

Documentation

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.