Is there any way to check if an asset exists? My theme is built with webpack, which is configured to extract css only in production (meaning my style.css
only exists in production but not during development).
Any ideas? Thanks!
Is there any way to check if an asset exists? My theme is built with webpack, which is configured to extract css only in production (meaning my style.css
only exists in production but not during development).
Any ideas? Thanks!
Could you use javascript to do this? Something like:
$.get(css_url)
.done(function() {
// load the css file or whatever
}).fail(function() {
// not exists code
})