node -v): 8.1.4npm -v): 5.0.3I have a fresh install of Laravel and within my blade templates I have references to an image like so:
<a class="navbar-brand" href="#"><img alt="Logo" src="{{ URL::asset('images/logo.png') }}"></a>
I have the image in:
- assets
- images > logo.png
But when I run npm run watch Or npm run dev all other image references that I have within CSS and or in a .vue file get optimized and moved into
- images
except for the image I am pointing to within my blade template. Is there a way to get webpack to parse blade templates for any image references? Or is there a loader that is blade specific.
Or does this need to be a manual process of adding the image to the public directory myself? or to use mix.copy() to copy that directory when the build is run.
Thank you
That asset helper is referencing public/images/logo.png, a non-existent image. If I'm not mistaken, in order for an image to be handled by mix and referenced correctly, it must be used in a file managed by webpack / mix. If you have images that aren't referenced in css, scss, less, js, etc., that you also want moved, you need to use mix.copy.
Right... I figured that much but was wondering if there was any plan on creating a blade-loader to check for file formats with .blade? Thanks guys!
I think @andrade1379 has a valid point. I am wondering the same thing.
Clearly there will be many cases when a .css file will only be required in a particular .blade file. Right now, it doesn't get processed by mix. Any plan of a 'blade-loader' to include scss and image files used in .blade templates?
+1 - also required for srcset/sizes-using img elements.
Most helpful comment
Right... I figured that much but was wondering if there was any plan on creating a blade-loader to check for file formats with .blade? Thanks guys!