Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce snippet dependency annotation #114

Open
karreiro opened this issue Sep 27, 2023 · 0 comments
Open

Introduce snippet dependency annotation #114

karreiro opened this issue Sep 27, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@karreiro
Copy link
Contributor

karreiro commented Sep 27, 2023

Are you seeking a solution to a specific problem? Let's delve into it.

Some Shopify Liquid assets, like snippets, depend on variables that are not defined in the global scope. Instead, these variables find their definition within the parent template.

This is about supporting a type annotation to declare those variables, so the UndefinedObject may rely on those annotations to understand the variables available in runtime for a given template. By doing so, we hope to create an intuitive interface definition for Liquid assets.

To illustrate a potential approach, consider the following code snippet. Please note that this is not the final syntax, but merely an example to help visualize the concept:

{% comment %}
  This snippet is designed to render product buy-buttons.
  It accepts several parameters:
  - product: {Object} Represents the product object.
  - block: {Object} Contains information about the block.
  - product_form_id: {String} Identifies the product form.
  - section_id: {String} Specifies the section to which this snippet belongs.
  - show_pickup_availability: {Boolean} Controls whether pickup availability is rendered. If set to true, pickup availability is displayed; if false, it's not (this is optional).

  Here's an example of how you might use it:
  {% render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true %}
{% endcomment %}
@charlespwd charlespwd changed the title [UndefinedObject] Introduce support for variable dependency annotation Introduce support for variable dependency annotation Feb 27, 2024
@charlespwd charlespwd changed the title Introduce support for variable dependency annotation Introduce snippet dependency annotation Feb 27, 2024
@mgmanzella mgmanzella added the enhancement New feature or request label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants