Skip to content

Commit

Permalink
Update warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Jan 14, 2022
1 parent f1a690e commit 4d16256
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib/expandTailwindAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ export default function expandTailwindAtRules(context) {
// If we've got a utility layer and no utilities are generated there's likely something wrong
// TODO: Detect utility variants only
if (layerNodes.utilities && utilityNodes.size === 0 && screenNodes.size === 0) {
log.warn('no-utilities-generated', [
'No utilities were generated there is likely a problem with the `content` key in the tailwind config.'
log.warn('content-problems', [
'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',
])
}

Expand Down
4 changes: 2 additions & 2 deletions src/util/normalizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ export function normalizeConfig(config) {
}

if (config.content.files.length === 0) {
log.warn('no-content-found', [
'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.'
log.warn('content-problems', [
'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',
])
}

Expand Down
6 changes: 3 additions & 3 deletions tests/warnings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('it warns when there is no content key', async () => {
await run(input, config)

expect(warn).toHaveBeenCalledTimes(1)
expect(warn.mock.calls.map((x) => x[0])).toEqual(['no-content-found'])
expect(warn.mock.calls.map((x) => x[0])).toEqual(['content-problems'])
})

test('it warns when there is an empty content key', async () => {
Expand All @@ -39,7 +39,7 @@ test('it warns when there is an empty content key', async () => {
await run(input, config)

expect(warn).toHaveBeenCalledTimes(1)
expect(warn.mock.calls.map((x) => x[0])).toEqual(['no-content-found'])
expect(warn.mock.calls.map((x) => x[0])).toEqual(['content-problems'])
})

test('it warns when there are no utilities generated', async () => {
Expand All @@ -55,7 +55,7 @@ test('it warns when there are no utilities generated', async () => {
await run(input, config)

expect(warn).toHaveBeenCalledTimes(1)
expect(warn.mock.calls.map((x) => x[0])).toEqual(['no-utilities-generated'])
expect(warn.mock.calls.map((x) => x[0])).toEqual(['content-problems'])
})

it('warnings are not thrown when only variant utilities are generated', async () => {
Expand Down

0 comments on commit 4d16256

Please sign in to comment.