Last active
June 27, 2019 13:50
-
-
Save BigWhale/1339ad5fc48a08bcc02e9b2a999e7100 to your computer and use it in GitHub Desktop.
Tailwind more pseudo classes and variants
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variants: { | |
margin: ['responsive', 'last-child', 'first-child', 'odd-child', 'even-child'], | |
}, | |
plugins: [ | |
function({ addVariant, e }) { | |
addVariant('first-child', ({ modifySelectors, separator }) => { | |
modifySelectors(({ className }) => { | |
return `.${e(`first-child${separator}${className}`)}:first-child` | |
}) | |
}) | |
}, | |
function({ addVariant, e }) { | |
addVariant('last-child', ({ modifySelectors, separator }) => { | |
modifySelectors(({ className }) => { | |
return `.${e(`last-child${separator}${className}`)}:last-child` | |
}) | |
}) | |
}, | |
function({ addVariant, e }) { | |
addVariant('odd-child', ({ modifySelectors, separator }) => { | |
modifySelectors(({ className }) => { | |
return `.${e(`odd-child${separator}${className}`)}:nth-child(odd)` | |
}) | |
}) | |
}, | |
function({ addVariant, e }) { | |
addVariant('even-child', ({ modifySelectors, separator }) => { | |
modifySelectors(({ className }) => { | |
return `.${e(`even-child${separator}${className}`)}:nth-child(even)` | |
}) | |
}) | |
}, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment