Currently, styles can only loosely be tied to components via CSS. This PR allows ReactPy to parse a CSS file and apply the CSS rules as in-line styles.
These styles are applied server-side, so certain limitations are unavoidable. For example, there's no way for media queries to function under this architecture, since the server currently has no way to query client-side DOM properties.
Some event based psuedo-selectors are going to be challenging as well (such as :hover). For example, event-based pseudo-selectors (such as :hover) may need to be handled via automatically generated html.script. Would be some ugly stuff though.
This PR may end up pivoting to a different design, or perhaps allow configurability between different client/server side methods of applying CSS.
fix #211
Checklist
Please update this checklist as you complete each item:
[ ] Tests have been developed for bug fixes or new functionality.
[ ] The changelog has been updated, if necessary.
[ ] Documentation has been updated, if necessary.
[ ] GitHub Issues closed by this PR have been linked.
By submitting this pull request I agree that all contributions comply with this project's open source license(s).
Description
Currently, styles can only loosely be tied to components via CSS. This PR allows ReactPy to parse a CSS file and apply the CSS rules as in-line styles.
These styles are applied server-side, so certain limitations are unavoidable. For example, there's no way for media queries to function under this architecture, since the server currently has no way to query client-side DOM properties.
It's going to be an uphill battle to develop support for all CSS psuedo-selectors (ex.
:first-child
).Some event based psuedo-selectors are going to be challenging as well (such as
:hover
). For example, event-based pseudo-selectors (such as:hover
) may need to be handled via automatically generatedhtml.script
. Would be some ugly stuff though.This PR may end up pivoting to a different design, or perhaps allow configurability between different client/server side methods of applying CSS.
fix #211
Checklist
Please update this checklist as you complete each item:
By submitting this pull request I agree that all contributions comply with this project's open source license(s).