Skip to content

Commit

Permalink
Fix CLI --content option (#5775)
Browse files Browse the repository at this point in the history
* Add failing test

* Fix CLI `--content` option
  • Loading branch information
bradlc committed Oct 13, 2021
1 parent 1a08732 commit 92df04d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions integrations/tailwindcss-cli/tests/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ describe('Build command', () => {
)
})

test('--content', async () => {
await writeInputFile('index.html', html`<div class="font-bold"></div>`)

await $(`${EXECUTABLE} --content ./src/index.html --output ./dist/main.css`)

expect(await readOutputFile('main.css')).toIncludeCss(
css`
.font-bold {
font-weight: 700;
}
`
)
})

test('--postcss (postcss.config.js)', async () => {
await writeInputFile('index.html', html`<div class="font-bold"></div>`)

Expand Down
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ async function build() {
}

if (args['--content']) {
resolvedConfig.content = args['--content'].split(/(?<!{[^}]+),/)
resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/)
}

return resolvedConfig
Expand Down

0 comments on commit 92df04d

Please sign in to comment.