forked from Workday/canvas-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
styling.config.ts
32 lines (27 loc) · 890 Bytes
/
styling.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {createConfig} from '@workday/canvas-kit-styling-transform';
import {handleFocusRing} from './utils/style-transform/handleFocusRing';
const config = createConfig({
prefix: 'cnvs',
getPrefix(path) {
const match = path.match(/.+modules\/(preview|labs)-react\/([^/]+)\/.+/);
if (match) {
return `cnvs-${match[1]}`;
}
return 'cnvs';
},
extractCSS: true,
getFileName(path) {
return path
.replace(/modules\/([^/]+)\/([^/]+)\/.+/, (_, modulePath, subPath) => {
return `modules/${modulePath.replace('react', 'css')}/${subPath}.css`;
})
.toLowerCase();
},
fallbackFiles: [
'@workday/canvas-tokens-web/css/base/_variables.css',
'@workday/canvas-tokens-web/css/brand/_variables.css',
'@workday/canvas-tokens-web/css/system/_variables.css',
],
objectTransforms: [handleFocusRing],
});
export default config;