-
Notifications
You must be signed in to change notification settings - Fork 364
Cannot reference JS asset files in Liquid #409
Comments
Wait so for my own sanity, it's currently impossible to include a script from the assets folder, right? Like the tutorial for multiple currencies is currently not actually achievable in Slate? |
@MitchEff -- correct. In the mean time, just import that file like any other JS file into your main theme JS file: src/assets/layout/theme.js
|
It also seems to be stripping stylesheet_tag and script_tag filters. input
output
|
Also stuck on this: the documentation of Slate needs huge improvement :(
|
@numediaweb can you show how you're referencing the .js file in your theme.liquid? |
@sebbean I fixed it by switching single quotes to double.. wasn't easy to find though in documentation :( |
@numediaweb Did you figure out where to put your css or js sources? I've tried putting them in various locations in the src folder, such as I've only found two options that work, but they aren't the best solution:
All of this was really straightforward with Slate v0, but Slate v1 is throwing me for a loop. |
@callaginn i'm putting them in my static folder actually
|
Assets have been simplified in #850 and the change is now available in v1.0.0-beta.12 Docs that have also been updated: |
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. |
Followup to #407 and #408
Problem
There is currently a bug when including a script asset reference, e.g.
<script src="{{ '../assets/scripts/modernizr.js' | asset_url }}"></script>
, where the src gets transformed into {{ [object Object] | asset_url }} and not {{ 'modernizr.js' | asset_url }}.Replication steps
How to replicate the problem. Screenshots or video?
More Information
This transformation happens so that in dev build (slate-tools start) we can reference the localhost, and then in prod build (slate-tools build) we can reference the lib uploaded on the Shopify CDN. To avoid this transformation and always reference the Shopify CDN, developers could use double quotes, e.g.
{{ "../assets/vendors/modernizr.js" | asset_url }}
, but we should also support the above approach.The text was updated successfully, but these errors were encountered: