Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit d14ed65

Browse files
committed
fix @media rules in scoped css mode
1 parent f524be2 commit d14ed65

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/style-rewriter.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ var options = require('./compilers/options')
66
var currentId
77
var addId = postcss.plugin('add-id', function () {
88
return function (root) {
9-
root.each(function (node) {
9+
root.each(function rewriteSelector (node) {
10+
if (!node.selector) {
11+
// handle media queries
12+
if (node.type === 'atrule' && node.name === 'media') {
13+
node.each(rewriteSelector)
14+
}
15+
return
16+
}
1017
node.selector = selectorParser(function (selectors) {
1118
selectors.each(function (selector) {
1219
var node = null

test/expects/scoped.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/scoped.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
div { color: red; }
33
.test { color: green; }
44
.test:after { content: 'bye!'; }
5+
@media print { div { color:green; } }
56
</style>
67

78
<template>

0 commit comments

Comments
 (0)