PostCSS plugin bundle that includes imports, variables, mixins, and nesting.
/* Before */
@import "base"; /* Contents of base.css: `body { margin: 0; }` */
/* After */
body { margin: 0; }
/* before */
$full-width: 100px;
.foo {
width: $full-width;
}
/* after */
.foo {
width: 100px;
}
/* before */
$full-width: 100px;
.foo {
width: $full-width;
}
/* after */
.foo {
width: 100px;
}
/* before */
@define-mixin link $link, $visited, $hover {
a {
color: $link;
}
a:visited {
color: $visited;
}
a:hover {
color: $hover;
}
}
.home {
@mixin link red, yellow, orange;
}
/* after */
.home a {
color: red
}
.home a:visited {
color: yellow
}
.home a:hover {
color: orange
}
/* before */
.foo {
.bar {
width: 100px;
}
}
.foo {
&.bar {
width: 200px;
}
}
/* after */
.foo .bar {
width: 100px;
}
.foo.bar {
width: 200px;
}
Run npm install postcss-packlite
postcss([ require('postcss-packlite') ])