mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Enable relative content paths for the oxide engine (#10621)
* enable `relativeContentPathsByDefault` for the `oxide` engine * update tests to reflect `relative` change in the `oxide` engine * update changelog
This commit is contained in:
parent
c8bf2d49b6
commit
962eb52ec6
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
|
||||
- [Oxide] Disable color opacity plugins by default in the `oxide` engine ([#10618](https://github.com/tailwindlabs/tailwindcss/pull/10618))
|
||||
- [Oxide] Enable relative content paths for the `oxide` engine ([#10621](https://github.com/tailwindlabs/tailwindcss/pull/10621))
|
||||
|
||||
## [3.2.7] - 2023-02-16
|
||||
|
||||
|
||||
@ -8,6 +8,9 @@ let defaults = {
|
||||
get disableColorOpacityUtilitiesByDefault() {
|
||||
return env.OXIDE
|
||||
},
|
||||
get relativeContentPathsByDefault() {
|
||||
return env.OXIDE
|
||||
},
|
||||
}
|
||||
|
||||
let featureFlags = {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { flagEnabled } from '../featureFlags'
|
||||
import log, { dim } from './log'
|
||||
|
||||
export function normalizeConfig(config) {
|
||||
@ -189,7 +190,7 @@ export function normalizeConfig(config) {
|
||||
return content.relative
|
||||
}
|
||||
|
||||
return config.future?.relativeContentPathsByDefault ?? false
|
||||
return flagEnabled(config, 'relativeContentPathsByDefault')
|
||||
})(),
|
||||
|
||||
files: (() => {
|
||||
|
||||
@ -36,19 +36,21 @@ crosscheck(({ stable, oxide }) => {
|
||||
|
||||
oxide.test.todo('should normalize extractors')
|
||||
stable.test.each`
|
||||
config
|
||||
${{ content: [{ raw: 'text-center' }], purge: { extract: () => ['font-bold'] } }}
|
||||
${{ content: [{ raw: 'text-center' }], purge: { extract: { DEFAULT: () => ['font-bold'] } } }}
|
||||
${{
|
||||
content: [{ raw: 'text-center' }],
|
||||
purge: { options: { defaultExtractor: () => ['font-bold'] } },
|
||||
}}
|
||||
${{
|
||||
content: [{ raw: 'text-center' }],
|
||||
purge: { options: { extractors: [{ extractor: () => ['font-bold'], extensions: ['html'] }] } },
|
||||
}}
|
||||
${{ content: [{ raw: 'text-center' }], purge: { extract: { html: () => ['font-bold'] } } }}
|
||||
`('should normalize extractors $config', ({ config }) => {
|
||||
config
|
||||
${{ content: [{ raw: 'text-center' }], purge: { extract: () => ['font-bold'] } }}
|
||||
${{ content: [{ raw: 'text-center' }], purge: { extract: { DEFAULT: () => ['font-bold'] } } }}
|
||||
${{
|
||||
content: [{ raw: 'text-center' }],
|
||||
purge: { options: { defaultExtractor: () => ['font-bold'] } },
|
||||
}}
|
||||
${{
|
||||
content: [{ raw: 'text-center' }],
|
||||
purge: {
|
||||
options: { extractors: [{ extractor: () => ['font-bold'], extensions: ['html'] }] },
|
||||
},
|
||||
}}
|
||||
${{ content: [{ raw: 'text-center' }], purge: { extract: { html: () => ['font-bold'] } } }}
|
||||
`('should normalize extractors $config', ({ config }) => {
|
||||
return run('@tailwind utilities', config).then((result) => {
|
||||
return expect(result.css).toMatchFormattedCss(css`
|
||||
.font-bold {
|
||||
@ -111,12 +113,18 @@ crosscheck(({ stable, oxide }) => {
|
||||
content: ['./example-folder/**/*.{html,js}'],
|
||||
}
|
||||
|
||||
expect(normalizeConfig(resolveConfig(config)).content).toEqual({
|
||||
stable.expect(normalizeConfig(resolveConfig(config)).content).toEqual({
|
||||
files: ['./example-folder/**/*.{html,js}'],
|
||||
relative: false,
|
||||
extract: {},
|
||||
transform: {},
|
||||
})
|
||||
oxide.expect(normalizeConfig(resolveConfig(config)).content).toEqual({
|
||||
files: ['./example-folder/**/*.{html,js}'],
|
||||
relative: true,
|
||||
extract: {},
|
||||
transform: {},
|
||||
})
|
||||
})
|
||||
|
||||
it('should warn when we detect invalid globs with incorrect brace expansion', () => {
|
||||
@ -130,8 +138,10 @@ crosscheck(({ stable, oxide }) => {
|
||||
],
|
||||
}
|
||||
|
||||
let normalizedConfig = normalizeConfig(resolveConfig(config)).content
|
||||
|
||||
// No rewrite happens
|
||||
expect(normalizeConfig(resolveConfig(config)).content).toEqual({
|
||||
stable.expect(normalizedConfig).toEqual({
|
||||
files: [
|
||||
'./{example-folder}/**/*.{html,js}',
|
||||
'./{example-folder}/**/*.{html}',
|
||||
@ -141,6 +151,16 @@ crosscheck(({ stable, oxide }) => {
|
||||
extract: {},
|
||||
transform: {},
|
||||
})
|
||||
oxide.expect(normalizedConfig).toEqual({
|
||||
files: [
|
||||
'./{example-folder}/**/*.{html,js}',
|
||||
'./{example-folder}/**/*.{html}',
|
||||
'./example-folder/**/*.{html}',
|
||||
],
|
||||
relative: true,
|
||||
extract: {},
|
||||
transform: {},
|
||||
})
|
||||
|
||||
// But a warning should happen
|
||||
expect(spy).toHaveBeenCalledTimes(2)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user