1 | var postcss = require('postcss')
|
2 |
|
3 | module.exports = postcss.plugin('postcss-atroot', function (opts) {
|
4 | opts = opts || {}
|
5 | return function (root, opts) {
|
6 | root.walkAtRules('at-root', function (rule) {
|
7 | var p = rule
|
8 | // Find first node from root to move child nodes after it
|
9 | while (p && p.parent !== root) p = p.parent
|
10 | root.insertBefore(p, rule.nodes)
|
11 | rule.remove()
|
12 | })
|
13 | }
|
14 | })
|