Skip to content

Instantly share code, notes, and snippets.

@akoepcke
Forked from samselikoff/tailwind.config.js
Created April 17, 2021 21:39
Show Gist options
  • Save akoepcke/3f03df79ab10e1e0e40acebe09d865f3 to your computer and use it in GitHub Desktop.
Save akoepcke/3f03df79ab10e1e0e40acebe09d865f3 to your computer and use it in GitHub Desktop.
Firefox plugin for Tailwind CSS. Add styles that target Firefox browser only.
const plugin = require("tailwindcss/plugin");
module.exports = {
mode: "jit",
purge: {
content: ["./src/**/*.{js,ts,jsx,tsx,mdx,vue}"],
},
theme: { extend: {} },
variants: {},
plugins: [
plugin(function ({ addVariant, e, postcss }) {
addVariant("firefox", ({ container, separator }) => {
const isFirefoxRule = postcss.atRule({
name: "-moz-document",
params: "url-prefix()",
});
isFirefoxRule.append(container.nodes);
container.append(isFirefoxRule);
isFirefoxRule.walkRules((rule) => {
rule.selector = `.${e(
`firefox${separator}${rule.selector.slice(1)}`
)}`;
});
});
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment