Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shadowed variable when using raw content #9773

Merged
merged 3 commits into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Fixed use of `raw` content in the CLI ([#9773](https://github.com/tailwindlabs/tailwindcss/pull/9773))

## [3.2.2] - 2022-11-04

Expand Down
34 changes: 34 additions & 0 deletions integrations/tailwindcss-cli/tests/integration.test.js
Expand Up @@ -191,6 +191,40 @@ describe('static build', () => {
`
)
})

it('should work with raw content', async () => {
await writeInputFile(
'../tailwind.config.js',
javascript`
module.exports = {
content: {
files: [{ raw: 'bg-red-500'}],
},
theme: {
extend: {
},
},
corePlugins: {
preflight: false,
},
plugins: [],
}
`
)

await $('node ../../lib/cli.js -i ./src/index.css -o ./dist/main.css', {
env: { NODE_ENV: 'production' },
})

expect(await readOutputFile('main.css')).toIncludeCss(
css`
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
`
)
})
})

describe('watcher', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/cli/build/plugin.js
Expand Up @@ -195,8 +195,8 @@ let state = {
return file !== null && typeof file === 'object'
})

for (let { raw: content, extension = 'html' } of rawContent) {
content.push({ content, extension })
for (let { raw: htmlContent, extension = 'html' } of rawContent) {
content.push({ content: htmlContent, extension })
}

return content
Expand Down