This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtailwind.config.js
67 lines (64 loc) · 2.19 KB
/
tailwind.config.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* eslint-disable unicorn/no-keyword-prefix */
// const defaultTheme = require("tailwindcss/defaultTheme")
const colors = require("tailwindcss/colors")
const plugin = require("tailwindcss/plugin")
const selectorParser = require("postcss-selector-parser")
module.exports = {
purge: ["./index.html", "./**/*.vue"],
darkMode: false,
theme: {
extend: {
colors: {
gray: colors.trueGray,
blue: colors.lightBlue,
green: colors.green
},
fontFamily: {
display: ["Amatic SC"]
}
}
},
variants: {
extend: {
ringWidth: ["hocus", "focus-visible"],
backgroundOpacity: ["hocus"],
backgroundColor: ["hocus"],
scale: ["hocus"],
textDecoration: ["focus-visible"]
}
},
plugins: [
plugin(({ addVariant, config }) => {
const prefixClass = name => {
const prefix = config("prefix")
const getPrefix = typeof prefix === "function" ? prefix : () => prefix
return `${getPrefix(`.${name}`)}${name}`
}
addVariant("group-focus-within", ({ modifySelectors, separator }) => modifySelectors(({ selector }) =>
// eslint-disable-next-line implicit-arrow-linebreak
selectorParser(selectors => {
selectors.walkClasses(classNode => {
classNode.value = `group-focus-within${separator}${classNode.value}`
classNode.parent
.insertBefore(classNode, selectorParser()
.astSync(`.${prefixClass("group")}:focus-within `))
})
}).processSync(selector)))
addVariant("hocus", ({ modifySelectors, separator }) => {
modifySelectors(({ selector }) => selectorParser(selectors => {
const clonedSelectors = selectors.clone();
[selectors, clonedSelectors].forEach((sel, index) => {
sel.walkClasses(classNode => {
classNode.value = `hocus${separator}${classNode.value}`
classNode.parent.insertAfter(
classNode,
selectorParser.pseudo({ value: `:${index === 0 ? "hover" : "focus-visible"}` })
)
})
})
selectors.append(clonedSelectors)
}).processSync(selector))
})
})
]
}