Skip to content

Add support for CSS definitions from JavaScript files in the zeit/styled-jsx format #98

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

Closed
pungggi opened this issue Nov 13, 2017 · 11 comments

Comments

@pungggi
Copy link
Contributor

pungggi commented Nov 13, 2017

Hi for people using css in js solutions would be great to have this too..

It should be possible extracting the css from literals?

Similar to #69
But should be easier to accomplish.

@zignd
Copy link
Owner

zignd commented Nov 13, 2017

It is possible to extract, but it's tricky to differentiate a JavaScript object literal used for a specific purpose in the application of an object literal containing CSS definitions. But I'm open to ideas on how to interpret the code in this use case.

@pungggi
Copy link
Contributor Author

pungggi commented Nov 13, 2017 via email

@zignd
Copy link
Owner

zignd commented Nov 13, 2017

Are we talking about the same thing? At first, I thought you were suggesting a parsing engine for JS, one that would traverse the JavaScript files in a workspace looking for CSS class definitions inside object literals. But now it seems that you're talking about auto completion inside JavaScript files.

@pungggi
Copy link
Contributor Author

pungggi commented Nov 13, 2017

I really mean traverse js and or jsx to find css classes..

@pungggi
Copy link
Contributor Author

pungggi commented Nov 13, 2017

Shouldn t autocomplete already work with react?

@pungggi
Copy link
Contributor Author

pungggi commented Nov 13, 2017

I tried hacking a little bit with this extension, and what I see right now is that, when including javascript files the caching process takes some time. (especially when using npm..)
It should be possible to include or exclude certain pathes to search for. (maybe with regex?)

Basically what already stated here: #91

@zignd
Copy link
Owner

zignd commented Nov 13, 2017

I really mean traverse js and or jsx to find css classes..
See for example https://github.com/zeit/styled-jsx/blob/master/readme.md#keeping-css-in-separate-files

Oh, so you're suggesting support for CSS definitions in the format defined by the styled-jsx project you recently linked up there? Their format is possible to parse and there will be no conflicts with object literals.

Shouldn t autocomplete already work with react?

It already works, but you shows you auto completions only, it doesn't parse React code looking for CSS definitions.

@pungggi
Copy link
Contributor Author

pungggi commented Nov 13, 2017

yes this would be a good step..

@zignd zignd changed the title Feature add: JS parse engine Add support for CSS definitions from JavaScript files in the zeit/styled-jsx format Nov 13, 2017
@pungggi
Copy link
Contributor Author

pungggi commented Nov 14, 2017

@zignd Can I suggest a PR for this?

@zignd
Copy link
Owner

zignd commented Nov 14, 2017

Sure, I'd gladly review. Are you planning to work on those two formats?

<style jsx>{`
      p {
        color: red;
      }
    `}</style>
export default css`div { color: green; }`

@pungggi
Copy link
Contributor Author

pungggi commented Nov 15, 2017

Yes both.

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

No branches or pull requests

2 participants