Open mxmtsk opened 5 years ago
The assets folder on Shopify servers does not support subfolders. You can have subfolders in your Slate project, but they get flattened on build (look at your dist/
folder). Reference assets by file name: {{ 'icons.svg' | asset_url }}
.
See https://github.com/Shopify/slate/releases/tag/v1.0.0-beta.12 for more details
@t-kelly Sorry, we're still on a previous version where it was like this, but the problem won't change does it? It would still get loaded from localhost
when developing, which is the underlying issue.
Problem
We're creating an SVG Sprite for all our icons and load the icons via the
use
tag to get the benefit of caching this file. While developing it's not possible to load the SVG file cause Chrome blocks the request tolocalhost
for security reasons, because it's an XML and loading XML from a different domain is prohibited.Replication steps
Put an SVG in the asset folder and try to link it in your theme:
I think there's no real solution. The only thing I could think of would be an exception to the
asset_url
tag so that it serves the SVG directly from shopify, basically what it does with liquid files. When changed, upload the file and reload the browser.