-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove SASS from @shopify/polaris (#11677)
Part of https://github.com/Shopify/polaris-internal/issues/1345 - [x] I've tophatted [the storybook](https://5d559397bae39100201eedc1-bldfeadhvc.chromatic.com/) - [x] I've tophatted this [on staging](https://web.docs.shopify.io/docs/guides/staging#testing-your-code-in-staging) `staging-sxpt` --- ## Reviewing notes The majority of changes in this PR are file renames (`.scss` -> `.css` & their imports), which makes it hard to review the changes :( To view the config related changes, use this command: ```bash git diff main..HEAD -- ':!polaris-react/src/*' ':!polaris-react/postcss-mixins/*' ':!*.scss' ``` To see what the diff of the final generated .css is, read on... ### Diff details As well as Tophatting Storybook & web, another way to confirm nothing has broken / changed is comparing the built `styles.css` file agains [the current version](https://unpkg.com/browse/@shopify/polaris/build/esm/styles.css). The output is not identical, but we didn't expect it to be (eg; moving to CSS Custom Properties). We developed [a script](https://github.com/Shopify/polaris/blob/remove-sass-compiled-css/go.sh) to normalize the output between the two built `.css` files (one from `main`, the other from this `remove-sass` branch) which minimizes the diff to what's actually changed. For the full diff with inline comments on what's changed and why, see https://github.com/Shopify/polaris/pull/11718/files --------- Co-authored-by: Charles Lee <[email protected]>
- Loading branch information
1 parent
f9d5f25
commit f6ba2b2
Showing
375 changed files
with
1,860 additions
and
2,619 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/polaris': minor | ||
--- | ||
|
||
Migrated @shopify/polaris from SASS to CSS using postcss plugins |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/stylelint-polaris': minor | ||
--- | ||
|
||
Add `--pg-` as a disallowed CSS Custom Property prefix (these are "global" Custom Properties used within @shopify/polaris-react). |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
5 changes: 2 additions & 3 deletions
5
...-react/playground/DetailsPage.module.scss → ...s-react/playground/DetailsPage.module.css
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@define-mixin base-button-disabled { | ||
transition: none; | ||
box-shadow: none; | ||
border-color: var(--p-color-border-disabled); | ||
background: var(--p-color-bg-fill-disabled); | ||
color: var(--p-color-text-disabled); | ||
|
||
svg { | ||
fill: var(--p-color-icon-disabled); | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const {nullish} = require('./utils'); | ||
|
||
const DEFAULT_STYLE = 'base'; | ||
|
||
module.exports = (_, _style) => { | ||
const style = nullish(_style) ? DEFAULT_STYLE : _style; | ||
switch (style) { | ||
case 'base': { | ||
return { | ||
position: 'relative;', | ||
border: 'var(--p-border-width-050) solid var(--p-color-input-border);', | ||
backgroundColor: 'var(--p-color-bg-surface);', | ||
borderRadius: 'var(--p-border-radius-100);', | ||
'&.hover,&:hover': { | ||
cursor: 'pointer;', | ||
borderColor: 'var(--p-color-border-hover);', | ||
}, | ||
}; | ||
} | ||
case 'active': { | ||
return { | ||
borderColor: 'var(--p-color-border-emphasis);', | ||
|
||
'&::before': { | ||
opacity: 1, | ||
transform: 'scale(1);', | ||
'@media (-ms-high-contrast: active)': { | ||
border: 'var(--p-border-width-050) solid windowText;', | ||
}, | ||
}, | ||
}; | ||
} | ||
case 'disabled': { | ||
return { | ||
borderColor: 'var(--p-color-border-disabled);', | ||
|
||
'&::before': { | ||
backgroundColor: 'var(--p-color-bg-surface-disabled);', | ||
}, | ||
|
||
'&:hover': { | ||
cursor: 'default;', | ||
}, | ||
}; | ||
} | ||
case 'error': { | ||
return { | ||
borderColor: 'var(--p-color-border-critical);', | ||
backgroundColor: 'var(--p-color-bg-fill-critical-secondary);', | ||
|
||
'&.hover, &:hover': { | ||
borderColor: 'var(--p-color-border-critical);', | ||
}, | ||
|
||
'&::before': { | ||
backgroundColor: 'var(--p-color-border-critical);', | ||
}, | ||
}; | ||
} | ||
} | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = (_, ...selectors) => { | ||
// Duplicate the styles across each of the given selectors | ||
return selectors.reduce((result, selector) => { | ||
// Strip any wrapping quotes for complex selectors | ||
result[selector.replace(/^['"]?(.*?)['"]?$/, '$1')] = { | ||
'@mixin-content': {}, | ||
}; | ||
return result; | ||
}, {}); | ||
}; |
Oops, something went wrong.