Skip to content

Commit

Permalink
Add style extraction to build
Browse files Browse the repository at this point in the history
  • Loading branch information
jjenzz committed Aug 3, 2020
1 parent 7bda95d commit 159ea2d
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 680 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"test": "cross-env ts-node --transpile-only ./scripts/test packages",
"test:ci": "CI=true yarn test",
"bootstrap": "make bootstrap",
"build": "ts-node --transpile-only scripts/build-all",
"build": "ts-node --transpile-only scripts/build-all && yarn build:styles",
"build-package": "ts-node --transpile-only scripts/build-package",
"build:styles": "cross-env EXTRACT_CSS=true ts-node ./scripts/extract-styles packages/react",
"clean": "make clean",
"new-component": "cross-env CI=true ts-node ./scripts/new-component",
"nc": "yarn new-component",
Expand Down Expand Up @@ -102,6 +103,7 @@
"jest": "^26.2.2",
"jest-axe": "^3.5.0",
"jest-watch-typeahead": "^0.6.0",
"json-to-css": "^0.1.0",
"lerna": "^3.22.1",
"lerna-script": "^1.3.2",
"lodash": "^4.17.19",
Expand Down
23 changes: 0 additions & 23 deletions packages/core/css/package.json

This file was deleted.

23 changes: 0 additions & 23 deletions packages/core/css/src/hashStringIntoClass.ts

This file was deleted.

32 changes: 0 additions & 32 deletions packages/core/css/src/index.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/core/css/src/murmurhash.ts

This file was deleted.

39 changes: 0 additions & 39 deletions packages/core/css/src/stringifyCSSObj.ts

This file was deleted.

37 changes: 0 additions & 37 deletions packages/core/css/src/stylis.ts

This file was deleted.

12 changes: 11 additions & 1 deletion packages/core/utils/src/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ import kebabCase from 'lodash.kebabcase';
import { isFunction } from './typeUtils';

export function interopDataAttr(componentPart: string) {
return `data-interop-part-${kebabCase(componentPart)}`;
return `data-interop-${kebabCase(componentPart)}`;
}

export function interopDataAttrObj(componentPart: string) {
return { [interopDataAttr(componentPart)]: '' };
}

export function interopSelector(componentPart: string) {
return process.env.EXTRACT_CSS
? interopDataAttrSelector(componentPart)
: componentPart.toLowerCase().split('.').reverse()[0];
}

export function interopDataAttrSelector(componentPart: string) {
return `[${interopDataAttr(componentPart)}]`;
}

/**
* Get an element's owner document. Useful when components are used in iframes
* or other environments like dev tools.
Expand Down
Loading

0 comments on commit 159ea2d

Please sign in to comment.