ash_hq/assets/tailwind.config.js

99 lines
2.5 KiB
JavaScript
Raw Normal View History

const colors = require("tailwindcss/colors");
2024-04-03 09:38:44 +13:00
const fs = require("fs");
const plugin = require("tailwindcss/plugin");
const path = require("path");
2022-03-26 10:17:01 +13:00
module.exports = {
mode: "jit",
content: [
2024-04-03 09:38:44 +13:00
"./js/**/*.js",
"../lib/*_web/**/*.*ex",
"../lib/ash_hq/docs/extensions/**/*.*ex",
"../priv/blog/**/*.md",
"../deps/ash_authentication_phoenix/**/*.ex",
],
2022-03-26 10:17:01 +13:00
darkMode: "class",
theme: {
extend: {
2022-08-05 09:06:52 +12:00
typography: {
DEFAULT: {
css: {
"code::before": {
content: '""',
2022-08-05 09:06:52 +12:00
},
"code::after": {
content: '""',
},
},
},
2022-08-05 09:06:52 +12:00
},
2024-04-03 09:38:44 +13:00
colors: require("./tailwind.colors.json"),
2022-03-26 10:17:01 +13:00
},
},
variants: {
extend: {
display: ["dark"],
2022-03-26 10:17:01 +13:00
},
},
2022-03-29 08:47:43 +13:00
plugins: [
require("@tailwindcss/typography"),
require("@tailwindcss/forms"),
require("@tailwindcss/line-clamp"),
2024-04-03 09:38:44 +13:00
plugin(function ({ matchComponents, theme }) {
let iconsDir = path.join(__dirname, "./vendor/heroicons/optimized");
let values = {};
let icons = [
["", "/24/outline"],
["-solid", "/24/solid"],
["-mini", "/20/solid"],
];
icons.forEach(([suffix, dir]) => {
fs.readdirSync(path.join(iconsDir, dir)).map((file) => {
let name = path.basename(file, ".svg") + suffix;
values[name] = { name, fullPath: path.join(iconsDir, dir, file) };
});
});
matchComponents(
{
hero: ({ name, fullPath }) => {
let content = fs
.readFileSync(fullPath)
.toString()
.replace(/\r?\n|\r/g, "");
return {
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
"-webkit-mask": `var(--hero-${name})`,
mask: `var(--hero-${name})`,
"mask-repeat": "no-repeat",
"background-color": "currentColor",
"vertical-align": "middle",
display: "inline-block",
width: theme("spacing.5"),
height: theme("spacing.5"),
};
},
},
{ values },
);
}),
2022-03-29 08:47:43 +13:00
],
safelist: [
// Used in Table of Contents generation, which is stored in the DB and cannot be
// checked at build time.
"m-0",
"ml-0.5",
"mr-1",
"md:w-[20em]",
"md:p-4",
"md:float-right",
"list-[lower-alpha]",
"md:border",
"md:border-base-light-300",
"md:dark:border-base-dark-600",
"md:ml-8",
"md:mb-8",
"text-ellipsis",
"overflow-hidden",
],
2022-03-26 10:17:01 +13:00
};