ThisIsManta / stylus-supremacy

A Node.js script that helps formatting Stylus files.
https://thisismanta.github.io/stylus-supremacy
MIT License
88 stars 9 forks source link

[Bug Report] Error when using media query with a hash getter #18

Closed l1qu1d closed 6 years ago

l1qu1d commented 6 years ago

I have break points that are predefined in a hash object that I use with @media queries. I use the VsCode extension and it won't format my stylus code when using the below code.

When I use a hash getter on the media query I get, "ERROR: Found an input node of null".

Steps to reproduce

Example code: @media $display-breakpoints.md-and-up { }

Example hash: $display-breakpoints := { md-and-up: "only screen and (min-width: %s)" % $grid-breakpoints.md }

To recreate the error just go to https://thisismanta.github.io/stylus-supremacy/ and go to the section "Try it in your browser". Paste the media query example code above.

ThisIsManta commented 6 years ago

Could you give me the full example code which works in http://stylus-lang.com/try.html please?

l1qu1d commented 6 years ago

Here is the example code: stylus-lang.com example

ThisIsManta commented 6 years ago

Could you verify my fix by installing the side-load extension? https://1drv.ms/u/s!AopesDuNO8ZogtBUIAk4nqxhI9cOAw

Instructions can be found at https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix

Once the side-load extension has been installed, try repeating the issue above.

l1qu1d commented 6 years ago

It works if the code is in its own .styl file now, but doesn't work if you're using it in a single file app like Vuejs.

Example: <style lang="stylus" scoped> @media $display-breakpoints.md-and-up { } </style>

I'm using your plugin along with Vetur plugin for VsCode.

ThisIsManta commented 6 years ago

Vetur extension must be updated separately.

For Stylus Supremacy, please upgrade to version 2.7.2 now. For Vetur, please wait for PR https://github.com/vuejs/vetur/pull/659 to be merged.