-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpostcss.config.mjs
More file actions
39 lines (36 loc) · 1.29 KB
/
postcss.config.mjs
File metadata and controls
39 lines (36 loc) · 1.29 KB
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
33
34
35
36
37
38
39
// PostCSS config for Tailwind CSS processing
// Scopes all Tailwind output under .messaging-chat-root to avoid polluting Frappe desk styles
import tailwindcss from "tailwindcss";
import tailwindcssNesting from "@tailwindcss/nesting";
import postcssPrefixSelector from "postcss-prefix-selector";
import autoprefixer from "autoprefixer";
import cssnano from "cssnano";
export default {
plugins: [
tailwindcssNesting,
tailwindcss,
autoprefixer,
postcssPrefixSelector({
prefix: ".messaging-chat-root",
transform: function (prefix, selector, prefixedSelector) {
// Don't prefix selectors for popovers/dropdowns that render outside the root
if (
selector.startsWith("#frappeui-popper-root") ||
selector.startsWith("[data-tippy-root]") ||
selector.includes("[data-headlessui-") ||
selector.includes("[data-reka-")
) {
return selector;
}
// Popover content also needs to match without the prefix
const popoverSelectors = [
"#frappeui-popper-root " + selector,
"[data-tippy-root] " + selector,
"[data-reka-popper-content-wrapper] " + selector,
];
return [prefix + " " + selector, ...popoverSelectors].join(", ");
},
}),
cssnano,
],
};