Skip to content

Commit 1f5d117

Browse files
Fix shadowed variable when using raw content (#9773)
* Fix shadowed variable when using raw content * Add test * Update changelog Co-authored-by: Jordan Pittman <[email protected]>
1 parent 48c0dca commit 1f5d117

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Fixed use of `raw` content in the CLI ([#9773](https://github.com/tailwindlabs/tailwindcss/pull/9773))
1113

1214
## [3.2.2] - 2022-11-04
1315

integrations/tailwindcss-cli/tests/integration.test.js

+34
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,40 @@ describe('static build', () => {
191191
`
192192
)
193193
})
194+
195+
it('should work with raw content', async () => {
196+
await writeInputFile(
197+
'../tailwind.config.js',
198+
javascript`
199+
module.exports = {
200+
content: {
201+
files: [{ raw: 'bg-red-500'}],
202+
},
203+
theme: {
204+
extend: {
205+
},
206+
},
207+
corePlugins: {
208+
preflight: false,
209+
},
210+
plugins: [],
211+
}
212+
`
213+
)
214+
215+
await $('node ../../lib/cli.js -i ./src/index.css -o ./dist/main.css', {
216+
env: { NODE_ENV: 'production' },
217+
})
218+
219+
expect(await readOutputFile('main.css')).toIncludeCss(
220+
css`
221+
.bg-red-500 {
222+
--tw-bg-opacity: 1;
223+
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
224+
}
225+
`
226+
)
227+
})
194228
})
195229

196230
describe('watcher', () => {

src/cli/build/plugin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ let state = {
195195
return file !== null && typeof file === 'object'
196196
})
197197

198-
for (let { raw: content, extension = 'html' } of rawContent) {
199-
content.push({ content, extension })
198+
for (let { raw: htmlContent, extension = 'html' } of rawContent) {
199+
content.push({ content: htmlContent, extension })
200200
}
201201

202202
return content

0 commit comments

Comments
 (0)