-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.0.7: config fontSize values starting with a dash do not work #6599
Comments
We're upgrading from 1x to 3x so it might be something to do with that. It seems like fontSize values such as "-1h" work in 1x but not in 2x. In 3x it seems like it should work according to the playground but it doesn't. |
Is the following supported? fontSize: {
"-1": "1rem"
} If so, then it's likely a bug. If not, I will change all my values to the following... fontSize: {
"n1": "1rem"
} |
FWIW, Assuming the above is supported, the following could be used as a test based on the repro case: it('allows prefixing theme keys with -', () => {
let config = {
content: [
{
raw: html`<div class="zero">
<div class="neg">The font size should be 40px but its not</div>
The font size should be 10px and it is
</div>`,
},
],
corePlugins: { preflight: false },
plugins: [],
theme: {
fontSize: {
'-1h': '40px',
'0h': '10px',
},
},
}
let input = css`
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.neg {
@apply text--1h;
}
.zero {
@apply text-0h;
}
}
`
return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
.neg {
font-size: 40px;
}
.zero {
font-size: 10px;
}
`)
})
}) |
Hey! When you add a dash to the beginning of a config value in your // tailwind.config.js
modules.exports = {
theme: {
margin: {
'-2': '-0.5rem',
// This becomes `-mt-2`
}
}
} It sounds like maybe some utilities in previous versions of Tailwind were allowing you to use leading dashes in config values and generating classes that had double dashes in the middle, like As of Tailwind v3.0 this behavior should be totally consistent across all utilities, and there's no way to configure your theme to generate classes that include the double dash. Sorry that you've run into this, if you really need the class to be named @layer utilities {
.text--1h {
font-size: 40px;
}
} Hope that helps! 👍 |
What version of Tailwind CSS are you using?
3.0.7
What build tool (or framework if it abstracts the build tool) are you using?
postcss 8.4.5
What version of Node.js are you using?
v16.13.0
What browser are you using?
Chrome
What operating system are you using?
macOs
Reproduction URL
https://play.tailwindcss.com/njvEQhMmdu?file=css
Describe your issue
After upgrade from 3.0.6 to 3.0.7, seeing the following error:
Cannot read properties of undefined (reading 'parent')
If I log the following out...
I get...
Playground: https://play.tailwindcss.com/njvEQhMmdu?file=css
It seems like the fontSize with a negative value is no longer working?
The text was updated successfully, but these errors were encountered: