Similar Issue: Wrong url returned by \Roots\asset() function

Hello!

I think I am experiencing a similar problem to this old thread of the same name: https://discourse.roots.io/t/wrong-url-returned-by-roots-asset-function/23546 except our install doesn’t have Bud.

There is no bud config file.

I am just trying to change the site logo from a colored version to a white version on our dev site. Replace the current png file with a new png file.

Anyways…

In our header.blade.php file it has the following:

 <a class="brand" href="{{ home_url('/') }}"><img width="300" height="100" class="img-fluid" src="@asset('images/logo.png')"><span class="sr-only">{{ get_bloginfo('name', 'display') }}</span></a>

After replacing the file, clearing the cache and refreshing it appeared to be the original logo and not the new one. No apparent change.

After some digging, it looks like even with the original logo (which still is present on our production site) that this was never pulling from resources/assets/images to begin with, it is pulling from: https://nrtraininggroup.com/wp-content/themes/nrtg/dist/images/logo_0cc9d9342e387560132e.png

For curiousity sake, I replaced the logo_0cc9d9342e387560132e.png with my new logo.png file in this dist/images folder but it’s just a broken image now. :grin:

Any ideas?

*PS - If you’re wondering why I am trying to put a white logo on a white header, it is because in the long term, our new header will be dark… * :slightly_smiling_face:

-I initially posted this on that original thread but then realized our install is Sage 9. not 10. And since it doesn’t have Bud it probably shouldn’t be in the Bud section… My apologies for any double notifications!

Have you run yarn build or yarn build:production? Rebuilding the dist directory will add a new hash to the end of the filename and add a reference to that in the manifest.

4 Likes

Thank you, seems simple enough… but I have what is likely a n00b question… :upside_down_face:

What I don’t understand is how I would run a command, such as yarn build, on a live site?

I don’t see a command line option in our cPanel… :thinking:

Would this be something I run with WP-CLI?

If it is helpful, I am doing this from my work laptop which is running Windows 11 + WSL → Ubuntu

I tried changing the background color of the header too, just to see and that change also did not implement.

Which led me to this thread: How to get CSS changes applied to Sage theme - #3 by bigdaddyswag

So with your response along with the response on the other thread it’s just a matter of running yarn build.

I just that I have to figure out how to do that on a live site. I tried to access the site via an SSH key last night but it did not work. I think that is the right direction though…

I will update this thread once I get it. :grin:

oh I get it now. So what you want to do is run yarn build:production locally, then deploy the new dist directory to the production site.

How you do that could vary, but at the simplest, you could use FTP to connect to the server and replace the old dist with the new one you just generated. Instructions are largely the same as the ones for Sage 10, except Sage 9 uses dist instead of public for the directory name. Deploying Sage | Sage Docs | Roots

1 Like

It seems a lot of answers to my questions are in the Sage 9 ebook! :star_struck:
Things are making more sense to me now.