Only enable shadow lookup if shadowLookup experiment is enabled

This commit is contained in:
Adam Wathan 2018-07-11 11:51:47 -04:00
parent cfe492220c
commit 24e1385aca
2 changed files with 9 additions and 2 deletions

View file

@ -202,7 +202,12 @@ test('you can apply utility classes that do not actually exist as long as they w
.foo { margin-top: 1rem; }
`
return run(input).then(result => {
const config = {
...defaultConfig,
experiments: { shadowLookup: true },
}
return run(input, config).then(result => {
expect(result.css).toEqual(expected)
expect(result.warnings().length).toBe(0)
})

View file

@ -59,7 +59,9 @@ function findClass(classToApply, classTable, shadowLookup, onError) {
export default function(config, generatedUtilities) {
return function(css) {
const classLookup = buildClassTable(css)
const shadowLookup = buildShadowTable(generatedUtilities)
const shadowLookup = _.get(config, 'experiments.shadowLookup', false)
? buildShadowTable(generatedUtilities)
: {}
css.walkRules(rule => {
rule.walkAtRules('apply', atRule => {