Skip to content

Commit

Permalink
throw an error when applying the .group utility (aot mode)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Sep 1, 2021
1 parent 0303a12 commit 4db0441
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/util/resolveConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export default function resolveConfig(configs) {
let allConfigs = [
...extractPluginConfigs(configs),
{
content: [],
prefix: '',
important: false,
separator: ':',
Expand Down Expand Up @@ -302,10 +301,10 @@ function normalizeConfig(config) {
content: (() => {
let { content, purge } = config

if (Array.isArray(content)) return content
if (Array.isArray(content?.content)) return content.content
if (Array.isArray(purge)) return purge
if (Array.isArray(purge?.content)) return purge.content
if (Array.isArray(content)) return content
if (Array.isArray(content?.content)) return content.content

return []
})(),
Expand Down
8 changes: 6 additions & 2 deletions tests/jit/apply.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ function run(input, config = {}) {
})
}

function css(templates) {
return templates.join('')
}

test('@apply', () => {
let config = {
darkMode: 'class',
Expand Down Expand Up @@ -232,7 +236,7 @@ test('@apply error when using .group utility', async () => {
plugins: [],
}

let css = `
let input = css`
@tailwind components;
@tailwind utilities;
Expand All @@ -243,7 +247,7 @@ test('@apply error when using .group utility', async () => {
}
`

await expect(run(css, config)).rejects.toThrowError(
await expect(run(input, config)).rejects.toThrowError(
`@apply should not be used with the 'group' utility`
)
})
Expand Down

0 comments on commit 4db0441

Please sign in to comment.