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

Whitespace issues #509

Open
Windvis opened this issue Sep 10, 2024 · 0 comments
Open

Whitespace issues #509

Windvis opened this issue Sep 10, 2024 · 0 comments
Labels
bug Used when the PR fixes a bug included in a previous release.

Comments

@Windvis
Copy link
Contributor

Windvis commented Sep 10, 2024

We're using comments like this {{~!~}} to trim away leading and trailing whitespace from component templates. Apparently this only works in development builds. It seems comments are stripped in production builds, and as a result our whitespace trimming syntax is gone as well.

This is not an issue for most components, but some are whitespace sensitive (for example, AuLink / AuLinkExternal) and this causes incorrect rendering in the production app.

I asked around in the Discord, but it seems it's not clear if this whitespace trimming comment should have been supported in the first place.

Some options:

  1. trim the actual whitespace from the source code manually. This will result in templates that are less readable, but it would be the simplest solution (and we would need to use prettier ignore comments as well)
  2. try to use something like this addon: https://github.com/mainmatter/ember-hbs-minifier
  3. Wait for Whitespace handling for <template> tag emberjs/rfcs#982 which would also fix the problem

I'm inclined to go for option 1 for the components that need it and wait for something to be added to Ember itself (if ever). I'm not the biggest fan of adding a new build-time addon, since it might make the v2 addon conversion harder in the future.

Background info on why we went for the current solution: ember-cli/ember-template-imports#201

@Windvis Windvis added the bug Used when the PR fixes a bug included in a previous release. label Sep 10, 2024
@Windvis Windvis changed the title White space issues Whitespace issues Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used when the PR fixes a bug included in a previous release.
Projects
None yet
Development

No branches or pull requests

1 participant