Skip to content

Commit 64cf0b8

Browse files
authored
Remove false positive warning in CLI when using the --content option (#7220)
* ensure content files are available in config If you use the cli with the `--content` option, then we first resolve the config (empty), then add the `content` to the config. The issue is that this means that the content will be empty when you resolve it initially. This results in a warning in your terminal. Now, we will make sure to merge 2 configs if you have the `--content` data passed. We will also make sure to override the final `config.content.files` to whatever you passed in to make sure that this is the same behaviour as before. * update changelog
1 parent 35bac2a commit 64cf0b8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
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+
- Remove false positive warning in CLI when using the `--content` option ([#7220](https://github.com/tailwindlabs/tailwindcss/pull/7220))
1113

1214
## [3.0.16] - 2022-01-24
1315

src/cli.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ async function build() {
437437

438438
function resolveConfig() {
439439
let config = configPath ? require(configPath) : {}
440-
let resolvedConfig = resolveConfigInternal(config)
441440

442441
if (args['--purge']) {
443442
log.warn('purge-flag-deprecated', [
@@ -450,10 +449,13 @@ async function build() {
450449
}
451450

452451
if (args['--content']) {
453-
resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/)
452+
let files = args['--content'].split(/(?<!{[^}]+),/)
453+
let resolvedConfig = resolveConfigInternal(config, { content: { files } })
454+
resolvedConfig.content.files = files
455+
return resolvedConfig
454456
}
455457

456-
return resolvedConfig
458+
return resolveConfigInternal(config)
457459
}
458460

459461
function extractFileGlobs(config) {

0 commit comments

Comments
 (0)