Laravel mix, how to pass variable while mixing?

So I have a JS file that I want to mix and copy and compress using Laravel mix, my webpack.mix.js file looks like so:

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

mix.js('resources/js/foo/foo.js', 'public/foo.js');
mix.copy('public/foo.js', 'public/js/foo.js');
mix.version();

The thing is that foo.js has a variable called env which is set to dev on local envs and we set it to app on production.

Is there a way I can automate this? Can I pass the variable according to the env while mixing the file and set this?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3eigwIK
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

How to Create Treeview with Bootstrap and jQuery

Api routes not found when hosted laravel application on server

How to Add Images to Dropdown List using jQuery