diff --git a/src/lib/transform-content-atrule.js b/src/lib/transform-content-atrule.js index e9f7d39..dba3cf2 100644 --- a/src/lib/transform-content-atrule.js +++ b/src/lib/transform-content-atrule.js @@ -20,7 +20,9 @@ export default function transformContentAtrule(rule, opts) { // transform the clone children return transformNode(clone, opts).then(() => { // replace the @content at-rule with the clone children - rule.parent.insertBefore(rule, clone.nodes); + if (clone.nodes) { + rule.parent.insertBefore(rule, clone.nodes); + } rule.remove(); }) diff --git a/test/mixins.css b/test/mixins.css index 76ce5d1..80253a5 100644 --- a/test/mixins.css +++ b/test/mixins.css @@ -69,3 +69,12 @@ $default-radius: 2em; min-width: $min-width; } } + +.test-5c { + @include mixin-test-5(50em) { + } +} + +.test-5d { + @include mixin-test-5(20em); +} diff --git a/test/mixins.expect.css b/test/mixins.expect.css index 6fc25fe..49d6713 100644 --- a/test/mixins.expect.css +++ b/test/mixins.expect.css @@ -51,3 +51,13 @@ min-width: 60em; } } + +.test-5c { + @media (min-width: 50em) { + } +} + +.test-5d { + @media (min-width: 20em) { + } +}