question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image references within Blade templates are not being recognized during build

See original GitHub issue
  • Laravel Mix Version: 1.2.3
  • Node Version (node -v): 8.1.4
  • NPM Version (npm -v): 5.0.3
  • OS: OSX El Capitan

Description:

I 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:

resources
    - 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

public
    - 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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
andrade1379commented, Jul 19, 2017

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!

2reactions
ashish-czonecommented, Jan 4, 2018

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image references within Blade templates are not being ...
Image references within Blade templates are not being recognized ... or to use mix.copy() to copy that directory when the build is run....
Read more >
Image not showing in View (Laravel Blade file) - Stack Overflow
Image not showing in View (Laravel Blade file) ... in browser and by inspecting the page i have found that the URL it...
Read more >
Blade Templates - Laravel - The PHP Framework For Web ...
Blade is the simple, yet powerful templating engine provided with Laravel. Unlike other popular PHP templating engines, Blade does not restrict you from...
Read more >
Test and deploy Laravel applications with GitLab CI/CD and ...
To start, we create an Envoy.blade.php in the root of our app with a simple task to ... To be able to build,...
Read more >
Common VM error codes in Azure - Virtual Machines
Each error object always contains an error code and a message. If the VM is created with a template, the error object also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found