facebook / jsx

The JSX specification is a XML-like syntax extension to ECMAScript.

Home Page:http://facebook.github.io/jsx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Provision for style/external styles

ashokkumarsand opened this issue · comments

In JSX we can only apply styles in JSON object. There is some provision required, So user can also apply classes with attribute selector and other selectors
static style() { <style> [#/./name][attribute="value"][ |: pseudo| :: pseudo] { border: 1px solid #efefef; } </style> }

Use CSS modules.

@borela CSS module doesn't support the attribute selector

Yes it does, CSS modules are just normal CSS classes. For everything else just use the :global switch.

@borela But If we get in built react then there is no need to add third party api or library. currently we are using css module. but for large application that is bad pattern.

For example i want to apply style with nth selector then what happen.

With the global switch you can do that. As for the bad pattern, I disagree, my components has their CSS module in the same directory, for example:

login
   index.js
   style.mcss
list-of-users
  index.js
  style.mcss

I use mscss extension to identify css modules in webpack. That way I can have easily 1000+ components without major headaches.

@borela The issue which i facing is different. I am doing this with china-logic. But if we have attribute selector then that is very helpful.
Thanks for you assistance

I Think is that meaning of JSX is taken by JavaScript + Styles + XHTML then it make complete meaning of it

This JSX repo is a spec for the syntax definition of JSX and not for an implementation of React or any other library that might want to utilize this syntax.

The syntax that you describe is already covered by the JSX syntax specification, but not by React. You can open it up on React if you're interested in discussing any compatibility issues. Although what you're describing is also supported by React, you just have to make sure it gets rendered into a tree. If that tree is a shadow DOM it is also local to that subtree.

Actually I think what you're really asking for is a dupe of #74

@sebmarkbage The JSX syntax also having some provision for STYLE because without style Web development is in complete. IF JSX syntax having provision for Javascript with HTML/XHTML then it also have same tags for STYLE also, and from my perspective its incomplete.