147k views
5 votes
Which of the following would best describe the reason to use {%- tags around {% assign product_image_zoom_size = '1024x1024' -%}?

A) To hide the variable assignment in the rendered output
B) To ensure a line break after the variable assignment
C) To strip whitespace from the rendered output
D) To prevent the assignment from being overridden

User Mike Me
by
7.6k points

1 Answer

4 votes

Final answer:

In Liquid template language, the {%- tags are used around code to strip whitespace from the rendered HTML output, preventing unwanted spaces or line breaks.

Step-by-step explanation:

The {%- tags are used in Liquid, a template language, to control the way code is parsed and to manipulate the output. In this context, using {%- around {% assign product_image_zoom_size = '1024x1024' -%} serves a specific purpose. The correct answer is C) To strip whitespace from the rendered output. This means that any trailing and leading whitespace around this code will be removed in the final HTML, ensuring that the output doesn't contain unwanted spaces or line breaks that could affect layout or readability.

User Dave Dribin
by
8.0k points

No related questions found