Print sub-nodes of `@import` in Less (#2646)

Fixes part of #2584.
master
Simon Lydell 2017-08-21 21:28:22 +02:00 committed by Christopher Chedeau
parent 23e0e90779
commit 3e924474cd
3 changed files with 33 additions and 1 deletions

View File

@ -129,7 +129,16 @@ function genericPrint(path, options, print) {
" ",
n.directives ? concat([n.directives, " "]) : "",
adjustStrings(n.importPath, options),
";"
n.nodes.length > 0
? concat([
" {",
indent(
concat([softline, printNodeSequence(path, options, print)])
),
softline,
"}"
])
: ";"
]);
}
// postcss-media-query-parser

View File

@ -7,6 +7,23 @@ exports[`directives.css 1`] = `
`;
exports[`nodes.css 1`] = `
@import "test.less" {}
@import "test.less" {
a: b;
c: d;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@import "test.less";
@import "test.less" {
a: b;
c: d;
}
`;
exports[`url.css 1`] = `
@import url('foo');
$dir: 'fonts';

View File

@ -0,0 +1,6 @@
@import "test.less" {}
@import "test.less" {
a: b;
c: d;
}