Skip to content

build: remove whitespace at eof and between tags #4392

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

Closed

Conversation

willshowell
Copy link
Contributor

Fixes #1596

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 4, 2017
@@ -93,7 +93,9 @@ function inlineTemplate(content, urlResolver) {
const templateContent = fs.readFileSync(templateFile, 'utf-8');
const shortenedTemplate = templateContent
.replace(/([\n\r]\s*)+/gm, ' ')
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be a overkill fix. Why not just remove the space here and just replace it with an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't that remove the spaces between attributes too aggressively? Such as after <ng-content:

<ng-content select="[md-card-avatar], [mat-card-avatar]"></ng-content>
<div class="mat-card-header-text">
  <ng-content
      select="md-card-title, mat-card-title, md-card-subtitle, mat-card-subtitle,
      [md-card-title], [mat-card-title], [md-card-subtitle], [mat-card-subtitle]"></ng-content>
</div>
<ng-content></ng-content>

Copy link
Member

Choose a reason for hiding this comment

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

That's a good point. Couldn't we just use gulp-clean-css to do proper minifying?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sure. I considered reusing htmlmin, but that seemed like overkill to me haha. I'll close this if you'd prefer to take on a different approach.

Copy link
Member

Choose a reason for hiding this comment

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

You can just do it in that PR and you don't have to close the PR.

@jelbourn
Copy link
Member

Not sure what the status of this PR is now- I'm just going to close it and you can open a new one if you want to go for a different approach.

@jelbourn jelbourn closed this May 15, 2017
@willshowell willshowell deleted the fix/inline-template-whitespace branch July 28, 2017 19:31
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove trailing whitespace in inlined templates
4 participants