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

Add spaceless filter #2872

Merged
merged 4 commits into from
Mar 7, 2019
Merged

Add spaceless filter #2872

merged 4 commits into from
Mar 7, 2019

Conversation

fabpot
Copy link
Contributor

@fabpot fabpot commented Mar 7, 2019

No description provided.

@fabpot fabpot merged commit a22a5c4 into twigphp:1.x Mar 7, 2019
fabpot added a commit that referenced this pull request Mar 7, 2019
This PR was squashed before being merged into the 1.x branch (closes #2872).

Discussion
----------

Add spaceless filter

Commits
-------

a22a5c4 fixed CS
743767b re-implemented the spaceless tag to reuse the filter tag logic
b823898 added a spaceless filter
1ba7941 removed unneeded usage of spaceless in tests
@stof
Copy link
Member

stof commented Mar 7, 2019

I suggest adding a note in the doc about the performance impact of this. Spaceless happens at runtime, and calling it a lot can hurt performance.
In the past, Symfony optimized the form rendering a lot by using whitespace control instead of having lots of spaceless tags (note that this is not a general replacement, but it was a solution in this case as removed spaces in the Symfony form rendering were all coming from the template source code, and so could be stripped at compile-time instead).

@fabpot
Copy link
Contributor Author

fabpot commented Mar 10, 2019

@stof note added in 68bbf5e

@emodric
Copy link
Contributor

emodric commented Mar 12, 2019

@fabpot What's the reason for deprecating the tag? Removing code duplication or something else?

@stof
Copy link
Member

stof commented Mar 12, 2019

Removing duplication, and also advocating for the right usage of extension points. Modifying a string to remove spaces is what a filter should be doing, not a tag.

@emodric
Copy link
Contributor

emodric commented Mar 12, 2019

Thanks @stof !

@fabpot fabpot deleted the spaceless-filter branch August 26, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants