Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work properly with postcss-nested plugin #19

Closed
dumistoklus opened this issue Jan 2, 2021 · 3 comments
Closed

Doesn't work properly with postcss-nested plugin #19

dumistoklus opened this issue Jan 2, 2021 · 3 comments

Comments

@dumistoklus
Copy link

dumistoklus commented Jan 2, 2021

In example below I got an error after using postcss-csso plugin:

1.scss

.c {
    .touch &:hover {
        color: red;
    }
}

csso.js

const postcss = require('postcss');
const nested = require('postcss-nested');
const csso = require('postcss-csso');
const fs = require('fs');

fs.readFile('1.scss', (err, css) => {
    postcss([
        nested(),
        csso(),
    ])
        .process(css, {from: '1.scss', to: 'result.css'})
        .then(result => {
            fs.writeFile('result.css', result.css, () => true)
        });
});

in result

SyntaxError: Unexpected input
    at Object.error (\node_modules\←[4mcss-tree←[24m\lib\parser\create.js:240:19)
    at \node_modules\←[4mcss-tree←[24m\lib\parser\create.js:299:20
    at parseToCsso (\node_modules\←[4mpostcss-csso←[24m\lib\postcssToCsso.js:16:26)
    at postcssToCsso (\node_modules\←[4mpostcss-csso←[24m\lib\postcssToCsso.js:40:26)
    at Array.map (<anonymous>)
    at appendChildren (\node_modules\←[4mpostcss-csso←[24m\lib\postcssToCsso.js:10:39)
    at postcssToCsso (\node_modules\←[4mpostcss-csso←[24m\lib\postcssToCsso.js:41:24)
    at Array.map (<anonymous>) {
  source: ←[32m'.touch &:hover'←[39m,
  offset: ←[33m7←[39m,
  line: ←[33m1←[39m,
  column: ←[33m8←[39m,
  sourceFragment: ←[36m[Function (anonymous)]←[39m,
  parseError: { offset: ←[33m7←[39m, line: ←[33m1←[39m, column: ←[33m8←[39m }
}

But without ccso in plugin list, I got correctly compliled file:

result.css

.touch .c:hover {
    color: red;
}
@onigoetz
Copy link
Contributor

onigoetz commented Feb 7, 2021

Hi, my PR (#18) fixes this issue.
@lahmatiy can you have a look please ?

@dumistoklus
Copy link
Author

@lahmatiy Have some news?

@lahmatiy
Copy link
Owner

lahmatiy commented Apr 5, 2021

Fix published in 5.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants