You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
The Webpack liquid-loader would have the capability of parsing and extracting dependency declarations from Liquid files, including:
Static sections using the {% section %} tag
Snippets using the {% include %} tag
layout using the {% layout %} tag
assets using the filters like the asset_url filter
However, there is no way to declare a dependency that should be included in Webpack’s script and styles bundling. Without this capability, dependency declaration for a given UI are spread across two files that do not reference each other, e.g in Starter theme we have sections/product.liquid and scripts/sections/product.js. This is not super obvious, especially when first learning how to build Slate themes.
If liquid files could declare all possible dependencies, it would allow liquid files to act as the main central file for all dependencies related to the content of the liquid file.
Solution
A liquid {% import 'path' %} tag allows developers to declare dependencies that should be included in the build dependency tree. If liquid-loader encounters an {% import 'path' %} tag on build, it will add the referenced file as a dependency, and then erase the {% import %} statement from the final liquid file.
Example
This example relies on the following ‘reference dependencies via relative paths’ issue.
Let’s say Webpack encounters the following Liquid file:
And the contents of the files referenced in the {% import %} tags would be added to the appropriate bundle, e.g. template.product.js and template.product.css.
The text was updated successfully, but these errors were encountered:
Thank you. I'm aware and possess the files (as a matter of a slate build). What I'm finding is that the theme.scss isn't getting included in my theme. So I'm trying to get the theme.scss to link up with the main theme.liquid file. Not sure why slate create new-theme doesn't set me up with something functional.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Problem
The Webpack liquid-loader would have the capability of parsing and extracting dependency declarations from Liquid files, including:
{% section %}
tag{% include %}
tag{% layout %}
tagasset_url
filterHowever, there is no way to declare a dependency that should be included in Webpack’s script and styles bundling. Without this capability, dependency declaration for a given UI are spread across two files that do not reference each other, e.g in Starter theme we have
sections/product.liquid
andscripts/sections/product.js
. This is not super obvious, especially when first learning how to build Slate themes.If liquid files could declare all possible dependencies, it would allow liquid files to act as the main central file for all dependencies related to the content of the liquid file.
Solution
A liquid
{% import 'path' %}
tag allows developers to declare dependencies that should be included in the build dependency tree. If liquid-loader encounters an{% import 'path' %}
tag on build, it will add the referenced file as a dependency, and then erase the{% import %}
statement from the final liquid file.Example
This example relies on the following ‘reference dependencies via relative paths’ issue.
Let’s say Webpack encounters the following Liquid file:
/snippets/product-form/index.liquid/
On build, it would remove remove the
{% import %}
tags from the liquid file:/snippets/product-form/index.liquid/
And the contents of the files referenced in the
{% import %}
tags would be added to the appropriate bundle, e.g.template.product.js
andtemplate.product.css
.The text was updated successfully, but these errors were encountered: