Skip to content

Commit

Permalink
Fix extraction of multi-word utilities with arbitrary values and quot…
Browse files Browse the repository at this point in the history
…es (#8604)

* Fix extraction of multi-word utilityies with arbitrary values and quotes

* Update  changelog

* Fix changelog entry

This wasn’t in 3.1.2 oops
  • Loading branch information
thecrypticace committed Jun 12, 2022
1 parent ad98a61 commit a9c7e52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -7,15 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
- Fix extraction of multi-word utilities with arbitrary values and quotes ([#8604](https://github.com/tailwindlabs/tailwindcss/pull/8604))
- Fix casing of import of `corePluginList` type definition ([#8587](https://github.com/tailwindlabs/tailwindcss/pull/8587))

## [3.1.2] - 2022-06-10

### Fixed

- Ensure `\` is a valid arbitrary variant token ([#8576](https://github.com/tailwindlabs/tailwindcss/pull/8576))
- Enable `postcss-import` in the CLI by default in watch mode ([#8574](https://github.com/tailwindlabs/tailwindcss/pull/8574), [#8580](https://github.com/tailwindlabs/tailwindcss/pull/8580))
- Fix casing of import of `corePluginList` type definition ([#8587](https://github.com/tailwindlabs/tailwindcss/pull/8587))

## [3.1.1] - 2022-06-09

Expand Down
4 changes: 2 additions & 2 deletions src/lib/defaultExtractor.js
Expand Up @@ -37,7 +37,7 @@ function* buildRegExps(context) {
regex.any([
regex.pattern([
// Arbitrary values
/-\[[^\s:]+\]/,
/-(?:\w+-)*\[[^\s:]+\]/,

// Not immediately followed by an `{[(`
/(?![{([]])/,
Expand All @@ -48,7 +48,7 @@ function* buildRegExps(context) {

regex.pattern([
// Arbitrary values
/-\[[^\s]+\]/,
/-(?:\w+-)*\[[^\s]+\]/,

// Not immediately followed by an `{[(`
/(?![{([]])/,
Expand Down
8 changes: 8 additions & 0 deletions tests/default-extractor.test.js
Expand Up @@ -468,3 +468,11 @@ test('classes in slim templates', async () => {
expect(extractions).toContain('italic')
expect(extractions).toContain('text-gray-500')
})

test('multi-word + arbitrary values + quotes', async () => {
const extractions = defaultExtractor(`
grid-cols-['repeat(2)']
`)

expect(extractions).toContain(`grid-cols-['repeat(2)']`)
})

0 comments on commit a9c7e52

Please sign in to comment.