Skip to content

Commit 3d942ce

Browse files
committed
Improve various warnings
1 parent cca5a38 commit 3d942ce

5 files changed

+13
-7
lines changed

src/corePlugins.js

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export let variantPlugins = {
144144
log.warn('darkmode-false', [
145145
'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
146146
'Change `darkMode` to `media` or remove it entirely.',
147+
'https://tailwindcss.com/docs/upgrade-guide#remove-dark-mode-configuration',
147148
])
148149
}
149150

src/lib/expandTailwindAtRules.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ export default function expandTailwindAtRules(context) {
247247

248248
if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
249249
log.warn('content-problems', [
250-
'No utilities were generated, there is likely a problem with the `content` key in the Tailwind config. For more information see the documentation: https://tailwindcss.com/docs/content-configuration',
250+
'No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.',
251+
'https://tailwindcss.com/docs/content-configuration',
251252
])
252253
}
253254

src/lib/normalizeTailwindDirectives.js

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default function normalizeTailwindDirectives(root) {
4949
log.warn(`${atRule.name}-at-rule-deprecated`, [
5050
`The \`@${atRule.name}\` directive has been deprecated in Tailwind CSS v3.0.`,
5151
`Use \`@layer utilities\` or \`@layer components\` instead.`,
52+
'https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer',
5253
])
5354
}
5455
layerDirectives.add(atRule)

src/lib/setupContextUtils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ function registerPlugins(plugins, context) {
656656
log.warn('root-regex', [
657657
'Regular expressions in `safelist` work differently in Tailwind CSS v3.0.',
658658
'Update your `safelist` configuration to eliminate this warning.',
659-
// TODO: Add https://tw.wtf/regex-safelist
659+
'https://tailwindcss.com/docs/content-configuration#safelisting-classes',
660660
])
661661
continue
662662
}
@@ -714,6 +714,7 @@ function registerPlugins(plugins, context) {
714714
log.warn([
715715
`The safelist pattern \`${regex}\` doesn't match any Tailwind CSS classes.`,
716716
'Fix this pattern or remove it from your `safelist` configuration.',
717+
'https://tailwindcss.com/docs/content-configuration#safelisting-classes',
717718
])
718719
}
719720
}

src/util/normalizeConfig.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export function normalizeConfig(config) {
124124
log.warn('purge-deprecation', [
125125
'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
126126
'Update your configuration file to eliminate this warning.',
127-
// TODO: Add https://tw.wtf/purge-deprecation
127+
'https://tailwindcss.com/docs/upgrade-guide#configure-content-sources',
128128
])
129129
}
130130

@@ -145,7 +145,7 @@ export function normalizeConfig(config) {
145145
log.warn('prefix-function', [
146146
'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
147147
'Update `prefix` in your configuration to be a string to eliminate this warning.',
148-
// TODO: Add https://tw.wtf/prefix-function
148+
'https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function',
149149
])
150150
config.prefix = ''
151151
} else {
@@ -250,8 +250,8 @@ export function normalizeConfig(config) {
250250
for (let file of config.content.files) {
251251
if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
252252
log.warn('invalid-glob-braces', [
253-
`The glob pattern ${dim(file)} in your config is invalid.`,
254-
` Update it to ${dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`,
253+
`The glob pattern ${dim(file)} in your Tailwind CSS configuration is invalid.`,
254+
`Update it to ${dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`,
255255
// TODO: Add https://tw.wtf/invalid-glob-braces
256256
])
257257
break
@@ -260,7 +260,9 @@ export function normalizeConfig(config) {
260260

261261
if (config.content.files.length === 0) {
262262
log.warn('content-problems', [
263-
'The `content` key is missing or empty. Please populate the content key as Tailwind generates utilities on-demand based on the files that use them. For more information see the documentation: https://tailwindcss.com/docs/content-configuration',
263+
'The `content` option in your Tailwind CSS configuration is missing or empty.',
264+
'Configure your content sources or your generated CSS will be missing styles.',
265+
'https://tailwindcss.com/docs/content-configuration',
264266
])
265267
}
266268

0 commit comments

Comments
 (0)