-
Notifications
You must be signed in to change notification settings - Fork 727
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
Screen css #2744
Screen css #2744
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you were to push and pop the same screen multiple times, will it parse the CSS each time?
No. That's why there is a What do you think of this:
|
Related comments: #2744 (comment), #2744 (comment)
That's a weak set, right? Does that not mean that as soon as you pop the screen (and it goes out of scope), it will forget that it parsed the CSS. This may not be a problem, just wanted to understand.
Sounds like it may be worth exploring. Do you have an idea how you would implement it? |
I'd load and parse the styles into a separate stylesheet. |
Do not keep an explicit registry of screens whose CSS has been parsed. Instead, grow methods in the file monitor and in the stylesheet to check if a given path is already being monitored/sourced and add the paths if it isn't.
Clever. Lets consider that for a future update. |
"""File paths to load CSS from. | ||
|
||
Note: | ||
This CSS applies to the whole app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a huge footgun :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know. I wanted to try and restrict this via this suggestion but I don't think I'm supposed to go ahead and do it now... :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just shot myself in the foot with this footgun.
|
||
counter = 0 | ||
|
||
def reparse_wrapper(reparse): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Small suggestion: this feels like a good candidate for a snapshot test which could make sure that screen CSS and CSS_PATH works and the precedence is as expected.
I don't understand your suggestion. I have tests that check that the styles imported from the screen CSS and CSS_PATH variables are applied and with the correct precedence. |
Possibly, but you don't need to change them now. When I see tests that query the DOM and check styles it feels like it's trying to programmatically do something that snapshot tests give you for free. |
Ahhh ok. |
Closes #2137.
Adds
CSS
andCSS_PATH
class variables to screens.@willmcgugan inside
App._load_screen_css
, why don't I traverse all the rules that were read and dynamically add a CSS selector to match the screen so that screen CSS only matches the screen it was imported from?