I’m working on a custom theme (based off of Casper) and everything’s working great, locally. However, when I build and then zip my theme and upload it, most of the assets (pngs, webfonts, and background images in CSS) are getting corrupted. Or not loading. Or something.
Here’s where my WIP is:
I tried the encoding: false
fix in gulpfile.js
and I even downgraded gulp to v4.0.2 with no luck (I was using v5 initially). It seems some of the files just do not want to load and I cannot figure out why. Any help would be much appreciated! I’m getting frustrated, as locally it’s working like a charm.
Thanks!
Needing to downgrade was my first guess. Are you sure the assets you’re now zipping with gulp 4 are not corrupted?
Thanks, Cathy . I don’t think so, as everything’s loading locally? What’s bizarre is that some of the pngs are loading ok. Mostly, it’s background-image
and webfonts in CSS.
I couldn’t find documentation on using {{asset
in CSS files (it appears not to work) and so I’m doing src: url("/assets/fonts/font-name.woff2") format('woff2');
which may be an issue?
Using the web inspector, I’m seeing some images as An error occurred trying to load this resource.
Interestingly, if I reference an image that’s not loading in CSS using the asset
helper in HTML a la <img src="{{asset 'images/sb-made-mono.png'}}" />
the image loads fine. I took the ?v=1233456
string and added that to the CSS reference and it worked. So! I think the issue is loading assets (pngs and woff2 files) in the stylesheet does not seem to work without an asset helper?
Hmm. What url are you using, and what folder is the file in?