Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Disallow multiple selectors in arbitrary variants ([#10655](https://github.com/tailwindlabs/tailwindcss/pull/10655))
- Sort class lists deterministically for Prettier plugin ([#10672](https://github.com/tailwindlabs/tailwindcss/pull/10672))
- Ensure CLI builds have a non-zero exit code on failure ([#10703](https://github.com/tailwindlabs/tailwindcss/pull/10703))
- Remove blocklisted classes from autocomplete ([#10844](https://github.com/tailwindlabs/tailwindcss/pull/10844))

### Changed

Expand Down
3 changes: 3 additions & 0 deletions src/lib/setupContextUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,9 @@ function registerPlugins(plugins, context) {
}
}

// Exclude utilities that are known non-classes (e.g. from the blocklist)
output = output.filter((cls) => !context.notClassCache.has(cls))

return output
}

Expand Down
12 changes: 12 additions & 0 deletions tests/getClassList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ crosscheck(() => {
expect(classes).not.toContain('bg-red-500/50')
})

it('should not generate utilities that are present in the blocklist', () => {
let config = {
blocklist: ['font-bold'],
}

let context = createContext(resolveConfig(config))
let classes = context.getClassList()

expect(classes).toContain('font-normal')
expect(classes).not.toContain('font-bold')
})

it('should not generate utilities that are set to undefined or null to so that they are removed', () => {
let config = {
theme: {
Expand Down