Hey all, I am running into issues when running elixir and my staging / production servers are using the elixir() helper to serve assets from the build directories.
In my view i have this:
@if($app->environment('local','staging'))
<link href="{!! asset('css/all.css') !!}" rel="stylesheet">
@else
<link href="{!! elixir('css/all.css') !!}" rel="stylesheet">
@endif
The problem is:
- elixir versioned files are in public/build/css/
- local files are in public/css/
any img or asset i reference in the stylesheet will 404 as its directory depth has changed.
for reference here is my gulp file:
var elixir = require('laravel-elixir');
elixir(function (mix) {
mix.sass([
'main.scss'
]);
mix.styles([
'main.css',
'../../bower_components/slick-carousel/slick/slick.css'
]);
mix.scripts([
'../../bower_components/jquery/dist/jquery.js',
'../../bower_components/jquery-bez/jquery.bez.min.js',
'../../bower_components/jquery.cookie/jquery.cookie.js',
'../../bower_components/jquery.placeholder/jquery.placeholder.js',
'../../bower_components/fastclick/lib/fastclick.js',
'../../bower_components/foundation/js/foundation/foundation.js',
'../../bower_components/foundation/js/foundation/foundation.offcanvas.js',
'../../bower_components/foundation/js/foundation/foundation.magellan.js',
'../../bower_components/foundation/js/foundation/foundation.interchange.js',
'../../bower_components/foundation/js/foundation/foundation.clearing.js',
'../../bower_components/foundation/js/foundation/foundation.topbar.js',
'../../bower_components/foundation/js/foundation/foundation.tab.js',
'../../bower_components/greensock/src/minified/TimelineMax.min.js',
'../../bower_components/greensock/src/minified/TweenMax.min.js',
'foundation.equalizer.js',
'../../bower_components/slick-carousel/slick/slick.js',
'DrawSVGPlugin.js',
'jquery.simple-text-rotator.min.js',
'svg-icons.js',
'main.js'
]);
mix.version([
'public/js/all.js',
'public/css/all.css'
]);
});
Cheers all!