sloanelybutsurely.com/assets/tailwind.config.js

110 lines
4.6 KiB
JavaScript

// See the Tailwind configuration guide for advanced usage
// https://tailwindcss.com/docs/configuration
const plugin = require("tailwindcss/plugin")
const fs = require("fs")
const path = require("path")
module.exports = {
content: [
"./js/**/*.js",
"../lib/web.ex",
"../lib/web/**/*.*ex"
],
theme: {
extend: {
typography: ({ theme }) => ({
sloanely_but_surely: {
css: {
'--tw-prose-body': theme('colors.black'),
'--tw-prose-headings': theme('colors.black'),
'--tw-prose-lead': theme('colors.black'),
'--tw-prose-links': theme('colors.black'),
'--tw-prose-bold': theme('colors.black'),
'--tw-prose-counters': theme('colors.black'),
'--tw-prose-bullets': theme('colors.black'),
'--tw-prose-hr': theme('colors.black'),
'--tw-prose-quotes': theme('colors.black'),
'--tw-prose-quote-borders': theme('colors.gray[200]'),
'--tw-prose-captions': theme('colors.black'),
'--tw-prose-code': theme('colors.black'),
'--tw-prose-pre-code': theme('colors.black'),
'--tw-prose-pre-bg': theme('colors.black'),
'--tw-prose-th-borders': theme('colors.gray[400]'),
'--tw-prose-td-borders': theme('colors.gray[400]'),
// '--tw-prose-invert-body': theme('colors.pink[200]'),
// '--tw-prose-invert-headings': theme('colors.white'),
// '--tw-prose-invert-lead': theme('colors.pink[300]'),
// '--tw-prose-invert-links': theme('colors.white'),
// '--tw-prose-invert-bold': theme('colors.white'),
// '--tw-prose-invert-counters': theme('colors.pink[400]'),
// '--tw-prose-invert-bullets': theme('colors.pink[600]'),
// '--tw-prose-invert-hr': theme('colors.pink[700]'),
// '--tw-prose-invert-quotes': theme('colors.pink[100]'),
// '--tw-prose-invert-quote-borders': theme('colors.pink[700]'),
// '--tw-prose-invert-captions': theme('colors.pink[400]'),
// '--tw-prose-invert-code': theme('colors.white'),
// '--tw-prose-invert-pre-code': theme('colors.pink[300]'),
// '--tw-prose-invert-pre-bg': 'rgb(0 0 0 / 50%)',
// '--tw-prose-invert-th-borders': theme('colors.pink[600]'),
// '--tw-prose-invert-td-borders': theme('colors.pink[700]'),
}
}
})
},
},
plugins: [
require("@tailwindcss/forms"),
require("@tailwindcss/typography"),
// Allows prefixing tailwind classes with LiveView classes to add rules
// only when LiveView classes are applied, for example:
//
// <div class="phx-click-loading:animate-ping">
//
plugin(({ addVariant }) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])),
plugin(({ addVariant }) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])),
plugin(({ addVariant }) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])),
// Embeds Heroicons (https://heroicons.com) into your app.css bundle
// See your `CoreComponents.icon/1` for more information.
//
plugin(function({ matchComponents, theme }) {
let iconsDir = path.join(__dirname, "../deps/heroicons/optimized")
let values = {}
let icons = [
["", "/24/outline"],
["-solid", "/24/solid"],
["-mini", "/20/solid"],
["-micro", "/16/solid"]
]
icons.forEach(([suffix, dir]) => {
fs.readdirSync(path.join(iconsDir, dir)).forEach(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, "")
let size = theme("spacing.6")
if (name.endsWith("-mini")) {
size = theme("spacing.5")
} else if (name.endsWith("-micro")) {
size = theme("spacing.4")
}
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": size,
"height": size
}
}
}, { values })
})
]
}