Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Copy the contents of src/assets/images and src/assets/fonts #647

Merged
merged 1 commit into from
Jun 26, 2018

Conversation

t-kelly
Copy link
Contributor

@t-kelly t-kelly commented Jun 22, 2018

What are you trying to accomplish with this PR?

Fixes #611

Previously, to include an image in the theme build, it needed to be referenced somewhere in your theme's liquid:

<img src="{{ '../assets/images/placeholder.png' | asset_url }}">

This is because Slate needs to transform urls made with | asset_url to a localhost equivalent for development. For example, the above Liquid gets transformed to the following when running slate-tools start:

<img src="https://localhost:8080/placeholder.png">

The above approach is still recommended in order to properly load images while developing because it's not guaranteed that the image will be uploaded to Shopify CDNs. slate-tools start only uploads Liquid and JSON files to Shopify for development and relies on the local asset server to serve up all other assets from localhost.

However, an image may still be needed even if its not referenced in a Theme's liquid, for example if its generated dynamically after pageload. Its for for this reason we should copy all images to the dist/assets folder.

Please note that for slate-tools start images will still be served from localhost, so you'll need to make sure any URL you are generating is pointing to there.

@yankeyhotel
Copy link

Should this work in scss files?

@lock
Copy link

lock bot commented Oct 26, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants