bump. someone must already use this setup or am I missing a shortcoming in my plan?
Feb 14, 2017
1
Level 1
Always compile both debug and minified version
Running gulp --production before each commit leaves room for error. Running it in production means installing npm dependencies on there, which I would not like to do.
I would like to run gulp in development and have Elixir compile both a debug and a minified version of my JS. Here's a gulpfile that I tried:
const elixir = require('laravel-elixir');
require('laravel-elixir-vue-2');
// compile debug file
elixir((mix) => {
mix.webpack('app.js');
});
// turn on production
elixir.config.production = true;
// compile minified file
elixir(function(mix) {
mix.webpack('app.js', './public/js/app.min.js');
});
and then include the relevant file in my blade template based on the current environment.
However, calling elixir twice results in this error when opening the site in my browser:
Failed to mount component: template or render function not defined
This phenomenon is discussed here in a GitHub issue.
Does anyone have any ideas on how to achieve my desired setup?
Please or to participate in this conversation.