Skip to content

Twig helpers for stimulus vs. "native" syntax #17

@ThomasLandauer

Description

@ThomasLandauer

On https://symfonycasts.com/screencast/stimulus/ajax-html you're using "native" HTML/Stimulus syntax

data-search-preview-target=""

whereas on previous pages, you're using the Twig helpers, e.g.

{{ stimulus_controller('search-preview') }}

I have a general question: What's the advantage of those Twig helpers at all? At symfony/webpack-encore-bundle#119 (comment), you're saying:

Remembering the syntax for targets and actions is not always easy :)

But the Twig syntax needs to be remembered too... ;-)

If there are true advantages, they should be mentioned at https://symfony.com/doc/current/frontend/encore/simple-example.html#stimulus-symfony-ux - and if there aren't, then both syntaxes should be shown (as equivalently "valid" alternatives).

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