-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.11ty.js
49 lines (47 loc) · 1.1 KB
/
style.11ty.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
const autoprefixer = require("autoprefixer");
const colors = require("tailwindcss/colors");
const postcss = require("postcss");
const path = require("path");
const tailwind = require("tailwindcss");
exports.data = {
permalink({ page }) {
return `${page.filePathStem}.css`;
},
};
exports.render = async (data) => {
const compiler = postcss([
tailwind({
mode: "jit",
purge: ["*.hbs", path.join("_includes", "**", "*.hbs")],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
colors: {
gray: colors.blueGray,
teal: colors.teal,
},
},
},
variants: {
extend: {},
},
plugins: [],
}),
autoprefixer(),
]);
const result = await compiler.process(
["base", "components", "utilities"]
.map((key) => `@tailwind ${key};`)
.join("\n"),
{
from: path.join(
process.cwd(),
"node_modules",
"tailwindcss",
"tailwind.css"
),
to: path.join(process.cwd(), "_site", data.permalink(data)),
}
);
return result.css;
};