Last active
August 10, 2023 18:26
-
-
Save Merott/a9612e03555bae9f86f3d6c3ad48124e to your computer and use it in GitHub Desktop.
Automatically add corresponding max-width breakpoints for each existing breakpoint in Tailwind CSS
This file contains hidden or 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
const defaultTheme = require('tailwindcss/defaultTheme') | |
const screens = { ...defaultTheme.screens } | |
// add max-width screens/breakpoints prefixed with `-` | |
for (let screen in screens) { | |
const size = screens[screen] | |
if (typeof size === 'string') { | |
screens[`-${screen}`] = { max: `calc(${size} - 1px)` } | |
} | |
} | |
module.exports = { | |
theme: { | |
screens, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment