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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/release/inline-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

.replace(/"/g, '\\"');
.replace(/>\s</gm, '><')
.replace(/"/g, '\\"')
.trim();
return `template: "${shortenedTemplate}"`;
});
}
Expand Down