From 61aeada322f2cee5c2cae3c9f925868c3b9e538f Mon Sep 17 00:00:00 2001 From: Will Cosgrove Date: Tue, 8 Nov 2022 13:42:17 -0600 Subject: [PATCH 1/3] Fix shadowed variable when using raw content --- src/cli/build/plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/build/plugin.js b/src/cli/build/plugin.js index a06bca3be1ae..8d21516ef3ff 100644 --- a/src/cli/build/plugin.js +++ b/src/cli/build/plugin.js @@ -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 From fc3d60e5d796e9914f63bad974c8d6812c2cd53a Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Tue, 8 Nov 2022 16:59:21 -0500 Subject: [PATCH 2/3] Add test --- .../tailwindcss-cli/tests/integration.test.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/integrations/tailwindcss-cli/tests/integration.test.js b/integrations/tailwindcss-cli/tests/integration.test.js index 4a76cdfeff26..ddba060bcf0a 100644 --- a/integrations/tailwindcss-cli/tests/integration.test.js +++ b/integrations/tailwindcss-cli/tests/integration.test.js @@ -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', () => { From 30c5959815dd628e3fcd35f62f087c78d91e3037 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Tue, 8 Nov 2022 16:59:25 -0500 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a3570b0d66..3ddecbb34ff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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