Clip unbalanced closing brackets in arbitrary values (#9973)
* Properly clip when there are too many `]` characters * Update changelog
This commit is contained in:
parent
8f49251c0f
commit
e8b036567d
3 changed files with 8 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Add container queries plugin to standalone CLI ([#9865](https://github.com/tailwindlabs/tailwindcss/pull/9865))
|
||||
- Support renaming of output files by `PostCSS` plugin. ([#9944](https://github.com/tailwindlabs/tailwindcss/pull/9944))
|
||||
- Improve return value of `resolveConfig`, unwrap `ResolvableTo` ([#9972](https://github.com/tailwindlabs/tailwindcss/pull/9972))
|
||||
- Clip unbalanced brackets in arbitrary values ([#9973](https://github.com/tailwindlabs/tailwindcss/pull/9973))
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ function clipAtBalancedParens(input) {
|
|||
// This means that there was an extra closing `]`
|
||||
// We'll clip to just before it
|
||||
if (depth < 0) {
|
||||
return input.substring(0, match.index)
|
||||
return input.substring(0, match.index - 1)
|
||||
}
|
||||
|
||||
// We've finished balancing the brackets but there still may be characters that can be included
|
||||
|
|
|
|||
|
|
@ -482,3 +482,9 @@ test('a lot of data', () => {
|
|||
|
||||
expect(extractions).toContain(`underline`)
|
||||
})
|
||||
|
||||
test('ruby percent string array', () => {
|
||||
let extractions = defaultExtractor('%w[text-[#bada55]]')
|
||||
|
||||
expect(extractions).toContain(`text-[#bada55]`)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue