Create a single entrypoint for public sass API #2974
Merged
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.
WHY are these changes introduced?
Consuming applications currently have to reference two files to use our public sass API. Instead we should get people to use a single entry point now recent (since Nov 2019) versions of sewing-kit no-longer hardcode opinions about what our public api endpoints are named.
WHAT is this pull request doing?
Deprecate using foundation.scss and shared.scss to access our public
sass API. Instead consuming apps should import
_public-api.scss.By exposing a single entrypoint we make it slightly easier for consuming
apps to use our public API.
foundation.scss and shared.scss remain present for now to retain
compatability with sewing-kit versions older than 0.113.0 (released
Nov 2019), as older versions hardcoded those paths. They should be
deleted in Polaris v6, and v6 should require using sewing-kit >= 0.113.0
How to 🎩
Do a build, see that
styles/_public-api.scssandesnext/styles/_public-api.scssare created, and note that they contain the same imports asfoundation.scssandshared.scsscombined.Who does this affect and how?
Importing
_public-api.scssis functionally identical to importingfoundation.scssandshared.scss.Consuming applications using recent versions of sewing-kit (>=0.113.0)
Modern SK versions require consuming apps to explicitly configure usage of our public sass api if they wish to use it. Here is how web does it.
Instead of importing
esnext/styles/foundation.scssandesnext/styles/shared.scss, they should importesnext/styles/_public-api.scssinstead.Consuming applications using old versions of sewing-kit (< 0.113.0)
These old versions of sewing-kit implicitly configure the import of
esnext/styles/foundation.scssandesnext/styles/shared.scssinstead of making the App do it. As those two files continue to exist things will be fine until we remove those files in v6.At some point before that they will need to update to a version of sewing-kit >=0.113.0 and then configure their autoImport settings per the sewing-kit migration guide where they should point to
esnext/styles/_public-api.scss.Consumers not using sewing-kit at all
Any other consumer is getting at our API by importing
styles/foundation.scssandstyles/shared.scss, they should importstyles/_public-api.scssinstead. (that's not a typo remember that scss will look for partial files prefixed with an underscore)