refactor: use lightweight token in CDK drag-drop#19678
Merged
devversion merged 2 commits intoangular:lightweight-token-optimizationsfrom Jun 18, 2020
Merged
Conversation
Currently the `CdkDropList` directive always retains the `CdkDropListGroup` directive. This is not desired as the drop list group is not necessarily always used in combination with a drop list. Additionally, the `CdkDrag` directive always retains the `CdkDragHandle`, `CdkDragPlaceholder` and `CdkDragPreview` directives. This is neither desired because a handle, placeholder or preview can be consumed optionally. We should only bring those directives into applications when actually needed. Size measurements show that this saves around ~1.3kb if only a drop list and `cdkDrag` is used. The downside is that we add up ~200b if _all_ directives of the drag-drop module are used. Given the drag-drop has a size of around 45kb, the 1.3kb size improvement in the common case should be good (~3% reduction). Related to angular#19576.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the
CdkDropListdirective always retains theCdkDropListGroupdirective. This is not desired as the drop list group is not necessarily
always used in combination with a drop list.
Additionally, the
CdkDragdirective always retains theCdkDragHandle,CdkDragPlaceholderandCdkDragPreviewdirectives. This is neitherdesired because a handle, placeholder or preview can be consumed
optionally. We should only bring those directives into applications
when actually needed.
Size measurements show that this saves around ~1.3kb if only a drop
list and
cdkDragis used. The downside is that we add up ~200b ifall directives of the drag-drop module are used. Given the drag-drop
has a compressed size of around 45kb, the 1.3kb size improvement in
the common case should be good enough to move forward (~3% reduction).
@crisbeto Would be interesting to see what you think here. I think it's low-effort to
maintain these tokens here. The individual classes don't seem large in TS source,
but 3% in the common case can quickly cause apps to grow, so I think it would be valuable.
Related to #19576.