Skip to content

Add hasPrefix and hasSuffix string filters #352

@markst

Description

@markst

It would be helpful to support hasPrefix and hasSuffix filters in Stencil templates for cleaner string matching. For example:

{% if style.varName|hasPrefix:"ios" %}

Currently, this requires verbose workarounds using split/join, which are less readable and unintuitive for common cases like filtering prefixed style names.

extension Font {
  struct DesignSystem {
{%- for style in styles %}
{%- if style.varName|split:"ios"|join:"" != style.varName %}
    static func {{ style.varName }}() -> FigmaFont {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions