Skip to content

Commit d2aa700

Browse files
authored
Merge pull request #87 from GetStream/polyfilling
feat: Add CSS polyfills #85
2 parents b6bfd17 + f4bb14c commit d2aa700

File tree

4 files changed

+4975
-4291
lines changed

4 files changed

+4975
-4291
lines changed

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
"private": false,
1010
"style": "dist/css/index.css",
1111
"scripts": {
12-
"build": "rm -rf dist && mkdir -p dist && rm -rf dist-v2 && mkdir -p dist-v2 && yarn bundle-sass && yarn copy-assets && yarn copy-styles",
13-
"bundle-sass": "echo '\u001b[34mℹ\u001b[0m Compiling scss files to css bundle' && sass src/styles/index.scss dist/css/index.css --style compressed && sass src-v2/styles/index.scss dist-v2/css/index.css --style compressed && sass src-v2/styles/index.layout.scss dist-v2/css/index.layout.css --style compressed && echo '\u001b[32m✓\u001b[0m Finished bundling css'",
12+
"build": "yarn build-v1 && yarn build-v2",
13+
"build-v1": "rm -rf dist && mkdir -p dist && yarn bundle-sass && yarn copy-assets && yarn copy-styles",
14+
"build-v2": "rm -rf dist-v2 && mkdir -p dist-v2 && yarn transform && yarn compile-to-css",
15+
"transform": "postcss --dir dist-v2/scss --base src-v2/styles src-v2/styles",
16+
"compile-to-css": "sass dist-v2/scss/index.scss dist-v2/css/index.css --style compressed && sass dist-v2/scss/index.layout.scss dist-v2/css/index.layout.css --style compressed",
17+
"bundle-sass": "echo '\u001b[34mℹ\u001b[0m Compiling scss files to css bundle' && sass src/styles/index.scss dist/css/index.css --style compressed && echo '\u001b[32m✓\u001b[0m Finished bundling css'",
1418
"copy-assets": "echo '\u001b[34mℹ\u001b[0m Copying assets to distributed directory' && cp -R src/assets dist/assets && echo '\u001b[32m✓\u001b[0m Finished copying assets'",
1519
"copy-styles": "echo '\u001b[34mℹ\u001b[0m Copying scss files to distributed directory' && cp -R src/styles dist/scss && cp -R src-v2/styles dist-v2/scss && echo '\u001b[32m✓\u001b[0m Finished copying styles'",
1620
"lint": "stylelint '**/*.scss' --max-warnings 0",
@@ -47,6 +51,12 @@
4751
},
4852
"devDependencies": {
4953
"@semantic-release/git": "^10.0.1",
54+
"flex-gap-polyfill": "^4.1.0",
55+
"postcss": "^8.4.13",
56+
"postcss-cli": "^9.1.0",
57+
"postcss-dir-pseudo-class": "^6.0.4",
58+
"postcss-logical": "^5.0.4",
59+
"postcss-scss": "^4.0.4",
5060
"sass": "^1.39.2",
5161
"semantic-release": "^18.0.1",
5262
"stylelint": "^13.13.1",

postcss.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const postcssLogical = require('postcss-logical');
2+
const postcssDirPseudoClass = require('postcss-dir-pseudo-class');
3+
const postcssFlexGapPolyfill = require('flex-gap-polyfill');
4+
5+
module.exports = {
6+
syntax: 'postcss-scss',
7+
plugins: [postcssLogical({ preserve: true }), postcssDirPseudoClass(), postcssFlexGapPolyfill()],
8+
};

src-v2/styles/_utils.scss

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
}
66

77
@mixin component-layer-overrides($component-name) {
8-
background-color: var(--str-chat__#{$component-name}-background-color);
9-
color: var(--str-chat__#{$component-name}-color);
10-
font-family: var(--str-chat__#{$component-name}-font-family);
11-
box-shadow: var(--str-chat__#{$component-name}-box-shadow);
12-
border-radius: var(--str-chat__#{$component-name}-border-radius);
13-
border-block-start: var(--str-chat__#{$component-name}-border-block-start);
14-
border-block-end: var(--str-chat__#{$component-name}-border-block-end);
15-
border-inline-start: var(--str-chat__#{$component-name}-border-inline-start);
16-
border-inline-end: var(--str-chat__#{$component-name}-border-inline-end);
8+
// & selector is required for the postcss-logical plugin to properly transform the logical properties
9+
& {
10+
background-color: var(--str-chat__#{$component-name}-background-color);
11+
color: var(--str-chat__#{$component-name}-color);
12+
font-family: var(--str-chat__#{$component-name}-font-family);
13+
box-shadow: var(--str-chat__#{$component-name}-box-shadow);
14+
border-radius: var(--str-chat__#{$component-name}-border-radius);
15+
border-block-start: var(--str-chat__#{$component-name}-border-block-start);
16+
border-block-end: var(--str-chat__#{$component-name}-border-block-end);
17+
border-inline-start: var(--str-chat__#{$component-name}-border-inline-start);
18+
border-inline-end: var(--str-chat__#{$component-name}-border-inline-end);
19+
}
1720
}

0 commit comments

Comments
 (0)