Log1x / blade-svg-sage

A simple package to add support for Blade SVG by Adam Wathan to Roots Sage.
MIT License
72 stars 13 forks source link

Doesn't work when watching #15

Closed strarsis closed 5 years ago

strarsis commented 6 years ago

When using watch in sage9 theme using yarn start, the production assets in dist/ are cleaned up, hence blade-svg-sage can't find the SVGs and the page fails to load. How can it be configured to look for the SVGs in assets directory instead?

I have to use this workaround while watching:

add_filter('bladesvg_image_path', function () {
    return '/srv/www/web/app/themes/the-theme/resources/assets/images/svg/icon';
});
strarsis commented 6 years ago

@Log1x: Related roots discourse discussion: https://discourse.roots.io/t/asset-lookup-while-watching/12640

Log1x commented 6 years ago

I'm going to rewrite and fix a lot of these issues here shortly as I plan on using this in a project I'm currently working on.

I think it went in the wrong direction with a couple of the recent commits. There are a few things to consider:

  1. I merged a commit making it check the manifest for the final file name, but really; an SVG that's being read from the filesystem doesn't need to be cache busted.
  2. I'm unsure if we should read the SVG from dist or keep it defaulted to assets since, like the above, it's being read by the file system. At that point, it'd come down to if the assets folder is being pushed to the production server or not. But related to the roots discourse discussion above, whether the SVG's should actually live with the other assets while being used inline, is another point that needs to be addressed.
Log1x commented 5 years ago

v2.0.0 will take care of this.