Skip to content

Commit 33ee989

Browse files
committed
Fix compatibility with CSS Modules
1 parent 8afc95e commit 33ee989

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

lib/processor.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,11 @@ class Processor {
383383
if (this.disabledValue(decl, result)) return
384384

385385
let unprefixed = this.prefixes.unprefixed(decl.prop)
386-
for (let value of this.prefixes.values('add', unprefixed)) {
387-
value.process(decl, result)
386+
let list = this.prefixes.values('add', unprefixed)
387+
if (Array.isArray(list)) {
388+
for (let value of list) {
389+
if (value.process) value.process(decl, result)
390+
}
388391
}
389392
Value.save(this.prefixes, decl)
390393
})
@@ -465,9 +468,8 @@ class Processor {
465468

466469
// Values
467470
for (let checker of this.prefixes.values('remove', unprefixed)) {
468-
if (!checker.check(decl.value)) {
469-
continue
470-
}
471+
if (!checker.check) continue
472+
if (!checker.check(decl.value)) continue
471473

472474
unprefixed = checker.unprefixed
473475
let notHack = this.prefixes.group(decl).down(other => {

test/autoprefixer.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,10 @@ it('ignores unknown versions on request', () => {
543543
}).not.toThrow()
544544
})
545545

546+
it('works with CSS Modules', () => {
547+
postcss([autoprefixer()]).process(':export { selectors: _1q6ho_2 }').css
548+
})
549+
546550
describe('hacks', () => {
547551
it('ignores prefix IE filter', () => check('filter'))
548552
it('supports webkit filters', () => check('advanced-filter'))

0 commit comments

Comments
 (0)