Skip to content

Conversation

dgp1130
Copy link
Collaborator

@dgp1130 dgp1130 commented Oct 27, 2023

An array is no longer required in v17 and we always generate a single style or style URL anyways, so we may as well drop the array.

This actually revealed a bug in the Webpack compilation where an empty styles: '' string would break PostCSS / the Webpack loader. Fixed this by just skipping resource inlining for an empty string, since there's no work to do anyways.

@dgp1130 dgp1130 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: rc This PR is targeted for the next release-candidate labels Oct 27, 2023
…ck JIT compilations

Empty styles break the Webpack resource loader / PostCSS and generate an error. Fortunately there's no work to be done there, so we can just skip it and leave the empty string.
…le `style` or `styleUrl` property

An array is no longer required in v17 and we always generate a single style or style URL anyways, so we may as well drop the array.
@dgp1130 dgp1130 changed the title refactor: update component schematic to use single style or styleUrl property Fix empty styles string and update component schematic to use single styles or styleUrl property Oct 28, 2023
@dgp1130 dgp1130 requested review from alan-agius4 and clydin October 28, 2023 03:23
@dgp1130 dgp1130 marked this pull request as ready for review October 28, 2023 03:24
@alan-agius4 alan-agius4 removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Oct 28, 2023
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 28, 2023
@alan-agius4 alan-agius4 removed the request for review from clydin October 28, 2023 06:48
@alan-agius4 alan-agius4 merged commit 7b1fd9c into angular:main Oct 30, 2023
@@ -236,6 +236,11 @@ function transformInlineStyleLiteral(
return node;
}

// Don't transform empty strings as PostCSS will choke on them. No work to do anyways.
if (node.text === '') {

Choose a reason for hiding this comment

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

Should the input be trimmed first before the check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is only a problem if the file is completely empty, I think a file containing only whitespace should be ok.

Choose a reason for hiding this comment

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

Yeah, I guess just an optimization to not even use style processing since there's no styles in that case. Probably not worth it anyway

@dgp1130 dgp1130 deleted the single-style branch October 30, 2023 18:14
@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 Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants