Skip to content

Commit

Permalink
Remove false positive warning in CLI when using the --content option (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
RobinMalfait committed Jan 26, 2022
1 parent 35bac2a commit 64cf0b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

- Remove false positive warning in CLI when using the `--content` option ([#7220](https://github.com/tailwindlabs/tailwindcss/pull/7220))

## [3.0.16] - 2022-01-24

Expand Down
8 changes: 5 additions & 3 deletions src/cli.js
Expand Up @@ -437,7 +437,6 @@ async function build() {

function resolveConfig() {
let config = configPath ? require(configPath) : {}
let resolvedConfig = resolveConfigInternal(config)

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

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

return resolvedConfig
return resolveConfigInternal(config)
}

function extractFileGlobs(config) {
Expand Down

0 comments on commit 64cf0b8

Please sign in to comment.