-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpostcss.config.js
More file actions
28 lines (25 loc) · 821 Bytes
/
Copy pathpostcss.config.js
File metadata and controls
28 lines (25 loc) · 821 Bytes
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
import autoprefixer from 'autoprefixer';
import tailwindcss from 'tailwindcss';
import prefix from 'postcss-prefix-selector';
import rem2px from 'postcss-rem-to-responsive-pixel';
function transformSelector(prefix, selector, prefixedSelector, file) {
if (!file.includes('svelte') && !file.includes('tailwind')) return selector;
return selector
.replace('.dark body', ":host .dark [data-theme='skeleton']")
.replace(/^(html|body|:root)$/, ":host [data-theme='skeleton']")
.replace(/^(html|body|:root)/, ':host');
}
export default {
plugins: [
tailwindcss(),
prefix({ transform: transformSelector }),
autoprefixer(),
// 避免网页fontsize不同导致样式问题
rem2px({
rootValue: 16,
propList: ['*'],
transformUnit: 'px',
mediaQuery: true
})
]
};