This repository was archived by the owner on Jun 20, 2024. It is now read-only.
Filters, to pipe first or to pipe last? #12
charlespwd
started this conversation in
Polls
Replies: 1 comment
-
|
Pipe first was implemented in #46 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a sub-issue of #5, and I'm encountering a potentially controversial topic: to pipe first or to pipe last?
In order to honor our third principle, I'd like to open a discussion and gather your feedback.
Context
We know Liquid variables with a lot of filters can get quite long. Here's an example from Dawn
{{ product.featured_image | image_url: width: some_setting.width, crop: some_setting.crop | image_tag: loading: "lazy" }}This is longer than 80 characters (the default printWidth). When this happens, we need a rule on how to break this. We have 2 options:
Option 1: Pipe first
{{ product.featured_image | image_url: width: some_setting.width, crop: some_setting.crop | image_tag: loading: "lazy" }}Option 2: Pipe last
{{ product.featured_image | image_url: width: some_setting.width, crop: some_setting.crop | image_tag: loading: "lazy" }}Additional concerns
What do we do with arguments? My intuition points towards this rule: align with the first character in the pipe. However, whether we put the first argument on the same line or not might be controversial as well.
5 votes ·
Beta Was this translation helpful? Give feedback.
All reactions