mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Fix parsing body-less at-rule without terminating semicolon (#13978)
* ensure body-less at-rules without semicolon are parsed correctly * update changelog
This commit is contained in:
parent
8e97a48357
commit
992cf8d573
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Discard invalid classes such as `bg-red-[#000]` ([#13970](https://github.com/tailwindlabs/tailwindcss/pull/13970))
|
||||
- Fix parsing body-less at-rule without terminating semicolon ([#13978](https://github.com/tailwindlabs/tailwindcss/pull/13978))
|
||||
|
||||
## [4.0.0-alpha.17] - 2024-07-04
|
||||
|
||||
|
||||
@ -633,6 +633,14 @@ describe.each(['Unix', 'Windows'])('Line endings: %s', (lineEndings) => {
|
||||
).toEqual([{ kind: 'rule', selector: '@charset "UTF-8"', nodes: [] }])
|
||||
})
|
||||
|
||||
it('should parse an at-rule without a block or semicolon', () => {
|
||||
expect(
|
||||
parse(`
|
||||
@tailwind utilities
|
||||
`),
|
||||
).toEqual([{ kind: 'rule', selector: '@tailwind utilities', nodes: [] }])
|
||||
})
|
||||
|
||||
it("should parse an at-rule without a block or semicolon when it's the last rule in a block", () => {
|
||||
expect(
|
||||
parse(`
|
||||
|
||||
@ -461,6 +461,13 @@ export function parse(input: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a leftover `buffer` that happens to start with an `@` then it
|
||||
// means that we have an at-rule that is not terminated with a semicolon at
|
||||
// the end of the input.
|
||||
if (buffer[0] === '@') {
|
||||
ast.push(rule(buffer.trim(), []))
|
||||
}
|
||||
|
||||
// When we are done parsing then everything should be balanced. If we still
|
||||
// have a leftover `parent`, then it means that we have an unterminated block.
|
||||
if (closingBracketStack.length > 0 && parent) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user