Allow @tailwind screens directive inside an at-rule

This commit is contained in:
Adam Wathan 2017-11-09 15:10:53 -05:00
parent efc04881a3
commit 3a976a60d7

View File

@ -34,23 +34,23 @@ export default function(config) {
})
const hasScreenRules = finalRules.some(i => i.nodes.length !== 0)
if (!hasScreenRules) {
return
}
const includesScreensExplicitly = css.some(
rule => rule.type === 'atrule' && rule.params === 'screens'
)
let includesScreensExplicitly = false
css.walkAtRules('tailwind', atRule => {
if (atRule.params === 'screens') {
atRule.replaceWith(finalRules)
includesScreensExplicitly = true
}
})
if (!includesScreensExplicitly) {
css.append(finalRules)
return
}
css.walkAtRules('tailwind', atRule => {
if (atRule.params === 'screens') {
atRule.replaceWith(finalRules)
}
})
}
}