Skip to content

Instantly share code, notes, and snippets.

@NazCodeland
Last active April 21, 2024 22:46
Show Gist options
  • Save NazCodeland/74e6229f7ce19dc9239fcba8fe2621a0 to your computer and use it in GitHub Desktop.
Save NazCodeland/74e6229f7ce19dc9239fcba8fe2621a0 to your computer and use it in GitHub Desktop.
simple tailwind plugin
import plugin from 'tailwindcss/plugin';
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {}
},
plugins: [
plugin(function ({ addUtilities, addComponents, e, config, theme }) {
// Add your custom styles here
console.log(addUtilities, addComponents, e, config)
const neonUtilities = {};
const colors = theme('colors');
for (const color in colors) {
if (typeof (colors[color]) === 'object') {
const color1 = colors[color]['500'];
const color2 = colors[color]['700'];
neonUtilities[`.neon-${color}`] = {
boxShadow: `0 0 5px ${color1}, 0 0 20px ${color2}`,
}
}
}
addUtilities(neonUtilities)
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment