Created
February 18, 2024 15:57
-
-
Save RealTong/d1dad966e7d8d1ee86011e3272f32b72 to your computer and use it in GitHub Desktop.
TailwindCSS-screen-checkpoint plugin
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
module.exports = function ({ addComponents, theme }) { | |
const screens = theme('screens') | |
const ignoredScreens = theme('debugScreens.ignore', ['dark']) | |
const selector = theme('debugScreens.selector', '.debug') | |
const components = { | |
[`${selector}::before`]: Object.assign({ | |
position: 'fixed', | |
zIndex: '50', | |
width: 6, | |
height: 6, | |
borderRadius: '50%', | |
bottom: '12px', | |
right: '12px', | |
padding: 12, | |
fontSize: '0.75rem', | |
lineHeight: '1rem', | |
backgroundColor: 'rgba(0, 0, 0, 0.75)', | |
color: '#fff', | |
display: 'flex', | |
alignItems: 'center', | |
justifyContent: 'center', | |
content: `'xs'`, | |
}), | |
} | |
Object.entries(screens) | |
.filter(([screen]) => !ignoredScreens.includes(screen)) | |
.forEach(([screen]) => { | |
components[`@screen ${screen}`] = { | |
[`${selector}::before`]: { | |
content: `'${screen}'`, | |
}, | |
} | |
}) | |
addComponents(components) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment