Closed callahad closed 7 years ago
When running stylefmt against the expanded CSS, before
is an empty string. When running it against the nested CSS, it's not present in decl.raws
:
Input | decl.raws |
---|---|
.x{&.y{color:red}} | { between: ': ' } |
.x{}x.y{color:red} | { before: '', between: ': ' } |
It seems like a potential solution might be to treat an undefined before
as the empty string.
Stylefmt throws "Cannot read property 'split' of undefined" when used as part of a postcss-cli chain that includes postcss-nesting or postcss-nested.
Steps to reproduce:
npm install postcss-cli postcss-nesting stylefmt
echo ".x{&.y{color:red}}" | postcss --no-map -u postcss-nesting stylefmt
What should happen:
What actually happens:
Workaround:
If stylefmt is run separately, it works correctly:
echo ".x{&.y{color:red}}" | postcss --no-map -u postcss-nesting | postcss --no-map -u stylefmt
Further investigation:
decl.raws.before
isundefined
at formatDecls.js:65