Skip to content

Instantly share code, notes, and snippets.

@Merott
Last active August 10, 2023 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Merott/a9612e03555bae9f86f3d6c3ad48124e to your computer and use it in GitHub Desktop.
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
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