Skip to content

Commit 962eb52

Browse files
authored
Enable relative content paths for the oxide engine (tailwindlabs#10621)
* enable `relativeContentPathsByDefault` for the `oxide` engine * update tests to reflect `relative` change in the `oxide` engine * update changelog
1 parent c8bf2d4 commit 962eb52

4 files changed

Lines changed: 41 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
### Changed
2323

2424
- [Oxide] Disable color opacity plugins by default in the `oxide` engine ([#10618](https://github.com/tailwindlabs/tailwindcss/pull/10618))
25+
- [Oxide] Enable relative content paths for the `oxide` engine ([#10621](https://github.com/tailwindlabs/tailwindcss/pull/10621))
2526

2627
## [3.2.7] - 2023-02-16
2728

src/featureFlags.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ let defaults = {
88
get disableColorOpacityUtilitiesByDefault() {
99
return env.OXIDE
1010
},
11+
get relativeContentPathsByDefault() {
12+
return env.OXIDE
13+
},
1114
}
1215

1316
let featureFlags = {

src/util/normalizeConfig.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { flagEnabled } from '../featureFlags'
12
import log, { dim } from './log'
23

34
export function normalizeConfig(config) {
@@ -189,7 +190,7 @@ export function normalizeConfig(config) {
189190
return content.relative
190191
}
191192

192-
return config.future?.relativeContentPathsByDefault ?? false
193+
return flagEnabled(config, 'relativeContentPathsByDefault')
193194
})(),
194195

195196
files: (() => {

tests/normalize-config.test.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,21 @@ crosscheck(({ stable, oxide }) => {
3636

3737
oxide.test.todo('should normalize extractors')
3838
stable.test.each`
39-
config
40-
${{ content: [{ raw: 'text-center' }], purge: { extract: () => ['font-bold'] } }}
41-
${{ content: [{ raw: 'text-center' }], purge: { extract: { DEFAULT: () => ['font-bold'] } } }}
42-
${{
43-
content: [{ raw: 'text-center' }],
44-
purge: { options: { defaultExtractor: () => ['font-bold'] } },
45-
}}
46-
${{
47-
content: [{ raw: 'text-center' }],
48-
purge: { options: { extractors: [{ extractor: () => ['font-bold'], extensions: ['html'] }] } },
49-
}}
50-
${{ content: [{ raw: 'text-center' }], purge: { extract: { html: () => ['font-bold'] } } }}
51-
`('should normalize extractors $config', ({ config }) => {
39+
config
40+
${{ content: [{ raw: 'text-center' }], purge: { extract: () => ['font-bold'] } }}
41+
${{ content: [{ raw: 'text-center' }], purge: { extract: { DEFAULT: () => ['font-bold'] } } }}
42+
${{
43+
content: [{ raw: 'text-center' }],
44+
purge: { options: { defaultExtractor: () => ['font-bold'] } },
45+
}}
46+
${{
47+
content: [{ raw: 'text-center' }],
48+
purge: {
49+
options: { extractors: [{ extractor: () => ['font-bold'], extensions: ['html'] }] },
50+
},
51+
}}
52+
${{ content: [{ raw: 'text-center' }], purge: { extract: { html: () => ['font-bold'] } } }}
53+
`('should normalize extractors $config', ({ config }) => {
5254
return run('@tailwind utilities', config).then((result) => {
5355
return expect(result.css).toMatchFormattedCss(css`
5456
.font-bold {
@@ -111,12 +113,18 @@ crosscheck(({ stable, oxide }) => {
111113
content: ['./example-folder/**/*.{html,js}'],
112114
}
113115

114-
expect(normalizeConfig(resolveConfig(config)).content).toEqual({
116+
stable.expect(normalizeConfig(resolveConfig(config)).content).toEqual({
115117
files: ['./example-folder/**/*.{html,js}'],
116118
relative: false,
117119
extract: {},
118120
transform: {},
119121
})
122+
oxide.expect(normalizeConfig(resolveConfig(config)).content).toEqual({
123+
files: ['./example-folder/**/*.{html,js}'],
124+
relative: true,
125+
extract: {},
126+
transform: {},
127+
})
120128
})
121129

122130
it('should warn when we detect invalid globs with incorrect brace expansion', () => {
@@ -130,8 +138,10 @@ crosscheck(({ stable, oxide }) => {
130138
],
131139
}
132140

141+
let normalizedConfig = normalizeConfig(resolveConfig(config)).content
142+
133143
// No rewrite happens
134-
expect(normalizeConfig(resolveConfig(config)).content).toEqual({
144+
stable.expect(normalizedConfig).toEqual({
135145
files: [
136146
'./{example-folder}/**/*.{html,js}',
137147
'./{example-folder}/**/*.{html}',
@@ -141,6 +151,16 @@ crosscheck(({ stable, oxide }) => {
141151
extract: {},
142152
transform: {},
143153
})
154+
oxide.expect(normalizedConfig).toEqual({
155+
files: [
156+
'./{example-folder}/**/*.{html,js}',
157+
'./{example-folder}/**/*.{html}',
158+
'./example-folder/**/*.{html}',
159+
],
160+
relative: true,
161+
extract: {},
162+
transform: {},
163+
})
144164

145165
// But a warning should happen
146166
expect(spy).toHaveBeenCalledTimes(2)

0 commit comments

Comments
 (0)