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

[alpha20/22] Missing declaration name in declaration in media query #55

Closed
strarsis opened this issue Sep 8, 2017 · 4 comments
Closed

Comments

@strarsis
Copy link
Contributor

strarsis commented Sep 8, 2017

After updating css-tree to latest alpha (20/22),
declaration name in declaration in media query is missing in (svgo/inlineStyles plugin) tests,
see this pared-down test case: https://github.com/strarsis/svgo/tree/test-css-tree-alpha20

$ git clone https://github.com/strarsis/svgo
$ cd svgo
$ git checkout test-css-tree-alpha20
$ yarn install
$ npm test

Downgrading to older alpha (1.0.0-alpha18) resolves this issue,
see the working branch: https://github.com/strarsis/svgo/tree/inlineStyles.

Related issue?: #39

@lahmatiy
Copy link
Member

lahmatiy commented Sep 8, 2017

In your branch inlineStyles plugin does nothing https://github.com/strarsis/svgo/blob/test-css-tree-alpha20/plugins/inlineStyles.js

@strarsis
Copy link
Contributor Author

strarsis commented Sep 8, 2017

@lahmatiy: Correct, the issue occurs by just installing css-tree recent alphas,
apparently it also interfere with svgo internals.

@lahmatiy
Copy link
Member

lahmatiy commented Sep 8, 2017

@strarsis Since alpha20 Atrule.expression is always contain a AtruleExpression, so MediaQueryList lays one level deeper now. You need change line:

        if (selector.atrule.expression.type === 'MediaQueryList') {

to

        if (selector.atrule.expression &&
            selector.atrule.expression.children.first().type === 'MediaQueryList') {

This fixed problem on my side.

@strarsis
Copy link
Contributor Author

strarsis commented Sep 8, 2017

@lahmatiy: Thanks! For whatever reason this also influenced svgo without the plugin.

@strarsis strarsis closed this as completed Sep 8, 2017
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

2 participants