diff --git a/lib/style-rewriter.js b/lib/style-rewriter.js index 92e7fbf..7188e6a 100644 --- a/lib/style-rewriter.js +++ b/lib/style-rewriter.js @@ -9,7 +9,11 @@ var addId = postcss.plugin('add-id', function () { root.each(function (node) { node.selector = selectorParser(function (selectors) { selectors.each(function (selector) { - selector.append(selectorParser.attribute({ + var node = null + selector.each(function (n) { + if (n.type !== 'pseudo') node = n + }) + selector.insertAfter(node, selectorParser.attribute({ attribute: currentId })) }) diff --git a/test/expects/scoped.js b/test/expects/scoped.js index 570985e..a53482c 100644 --- a/test/expects/scoped.js +++ b/test/expects/scoped.js @@ -1,2 +1,2 @@ -var __vueify_style__ = require("vueify-insert-css").insert("div[{{id}}]{color:red}.test[{{id}}]{color:green}") +var __vueify_style__ = require("vueify-insert-css").insert("div[{{id}}]{color:red}.test[{{id}}]{color:green}.test[{{id}}]:after{content:'bye!'}") ;(typeof module.exports === "function"? module.exports.options: module.exports).template = "
hi

bye

" diff --git a/test/fixtures/scoped.vue b/test/fixtures/scoped.vue index cc33644..7383bf0 100644 --- a/test/fixtures/scoped.vue +++ b/test/fixtures/scoped.vue @@ -1,6 +1,7 @@