Hi @Screenbeetle
if (elixir.config.production) {
mix.version(['css/app.css', 'js/app.js'], 'public/build')
// 'public/build' above is also the default output dir in any case
}
if (! elixir.config.production) {
mix.version(['css/app.css', 'js/app.js'], 'public/build-dev')
// add 'public/build-dev' to your .gitignore
}
You must then include this in your blade layout file:
@if(config('app.env') === 'local')
<link href="{{ elixir('css/app.css', 'build-dev') }}" rel="stylesheet">
@else
<link href="{{ elixir('css/app.css') }}" rel="stylesheet">
@endif
plus the equivalent for your app.js
Finally, in your project directory, in .git/hooks/pre-commit
#!/usr/bin/env sh
echo 'Running pre-commit hook'
gulp --production
git add ./public/build/css ./public/build/js ./public/build/rev-manifest.json
This works fine for me with git CLI – stops all the garbage appearing in Github desktop while I'm working, plus does the production build automatically before every commit.
Unfortunately I haven't yet got Github Desktop to fully run this hook, it does run the hook itself, but not gulp, for some reason, so I have to manually run gulp --production before committing if I want to commit with Github Desktop, which is not a huge problem except that might forget to do it.
http://stackoverflow.com/questions/43279311/git-hook-not-completing-on-github-desktop-for-mac