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

refactor(cdk/overlay): use index files for public Sass API instead of copying files out #22343

Merged
merged 1 commit into from
Apr 7, 2021

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 25, 2021

Currently we copy out a few of the CDK .scss files to the root of the cdk package so that they're more convenient to consume. The problem with this is that it prevents us from importing other Sass files, because the import path will be wrong after the files are copied (see #22043).

These changes rename the files to _index.scss which will allow users to maintain the same import paths while allowing us to remove the file copying logic and not having to worry about import paths.

Note: the commit message mentions overlay due to the linting rules, but this also applies to a11y and text-field.

BREAKING CHANGES:
Deep imports to the following CDK .scss files need to be updated:

  • @import '~@angular/cdk/overlay/overlay' -> @import ~@angular/cdk/overlay
  • @import '~@angular/cdk/a11y/a11y' -> @import ~@angular/cdk/a11y
  • @import '~@angular/cdk/text-field/text-field' -> @import ~@angular/cdk/text-field

@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 25, 2021
@crisbeto crisbeto marked this pull request as ready for review March 25, 2021 19:19
@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: major This PR is targeted for the next major release labels Mar 25, 2021
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM. this is definitely better! One thing to note is that it will break if people did use something like:

@use '~@angular/cdk/_a11y.scss'

Though that is probably really uncommon (but maybe worth noting at least)?

src/cdk/BUILD.bazel Outdated Show resolved Hide resolved
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM- can you amend your commit with a breaking change message for the case of importing with the .scss extension?

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Mar 29, 2021
@crisbeto
Copy link
Member Author

Done. Also resolved the merge conflicts.

@crisbeto crisbeto force-pushed the cdk-index-files branch 2 times, most recently from d042d62 to ee2558c Compare March 30, 2021 15:09
… copying files out

Currently we copy out a few of the CDK .scss files to the root of the `cdk` package so that they're more convenient to consume. The problem with this is that it prevents us from importing other Sass files, because the import path will be wrong after the files are copied (see angular#22043).

These changes rename the files to `_index.scss` which will allow users to maintain the same import paths while allowing us to remove the file copying logic and not having to worry about import paths.

BREAKING CHANGES:
Deep imports to the following CDK .scss files need to be updated:
* `@import '~@angular/cdk/overlay/overlay'` -> `@import ~@angular/cdk/overlay`
* `@import '~@angular/cdk/a11y/a11y'` -> `@import ~@angular/cdk/a11y`
* `@import '~@angular/cdk/text-field/text-field'` -> `@import ~@angular/cdk/text-field`
@annieyw annieyw merged commit d3cb72e into angular:master Apr 7, 2021
@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 May 8, 2021
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 cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants