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

Allow macroCondition inside modifier #712

Merged
merged 1 commit into from
Mar 8, 2021

Conversation

simonihmig
Copy link
Collaborator

Previously the macro-if transform would already allow to switch between two modifier implementations with a (if (macroCondition ...) foo bar) sub-expression inside a modifier. This now also completely removes the modifier if the sub-expression statically evaluates to undefined, allowing you to conditionally apply modifiers. See #680 (comment)

Closes #680, supersedes #692.

Note this only works with Ember 3.25, which now allows you to use a sub-expression as the modifier path, see #680 (comment). Older versions would throw a parse error (not exactly sure at which version exactly the changes in the parser where introduced). Therefore I also had to replace the vendored template compiler (for tests) with that of Ember 3.25.

Previously the macro-if transform would already allow to switch between two modifier implementations with a `(if (macroCondition ...) foo bar)` sub-expression inside a modifier. This now also completely removes the modifier if the sub-expression statically evaluates to undefined, allowing you to conditionally apply modifiers. See embroider-build#680 (comment)

Closes embroider-build#680, supersedes embroider-build#692.

Note this only works with Ember 3.25, which now allows you to use a sub-expression as the modifier path, see embroider-build#680 (comment). Older versions would throw a parse error (not exactly sure at which version exactly the changes in the parser where introduced). Therefore I also had to replace the vendored template compiler (for tests) with that of Ember 3.25.
@simonihmig simonihmig added the enhancement New feature or request label Mar 7, 2021
Copy link
Collaborator

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks @simonihmig!

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

Successfully merging this pull request may close these issues.

macroMaybeModifier needed?
2 participants