tailwind-max-variants
Version:
A Tailwind CSS plugin that adds max-* responsive variants for each configured screen size.
16 lines (15 loc) • 474 B
JavaScript
// src/main.ts
import plugin from "tailwindcss/plugin";
var MaxVariantsPlugin = plugin(({ addVariant, theme }) => {
const screens = theme("screens");
if (!screens) {
throw new Error("Tailwind screens are not defined. Please ensure your Tailwind config includes a 'screens' definition.");
}
;
Object.entries(screens).forEach(([key, value]) => {
addVariant(`max-${key}`, `@media not all and (min-width: ${value})`);
});
});
export {
MaxVariantsPlugin
};