Skip to content
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

Nesting CSS does not work with textual-dev #31

Open
mohammad-sayed-ahmad opened this issue Feb 21, 2024 · 3 comments
Open

Nesting CSS does not work with textual-dev #31

mohammad-sayed-ahmad opened this issue Feb 21, 2024 · 3 comments

Comments

@mohammad-sayed-ahmad
Copy link

Hello everyone,
I have been recently using the textual-dev cli and I have been facing an extremely peculiar issue.
Whenever I try nesting CSS using the & it fails horibbly.

Minimum Reproducible Example:

issue.py

from textual.app import App
from textual.widgets import Static

class BasicWidget(Static):
    def compose(self):
        yield Static("Inside", classes="inside")


class BasicApp(App):
    CSS_PATH = "issue.tcss"
    def compose(self):
        yield BasicWidget()
    

if __name__ == '__main__':
    app = BasicApp()
    app.run()

issue.tcss

BasicWidget {
    background: red;
    width: 40;

    & .inside {
        background: green;
        width: 10;
    }
}

———————————————————————————————————————————————————————————
Commands Tested:
python issue.py -> Works normally
textual run issue.py --dev -> The following error in stylesheet:

 • Expected one of 'comment line', 'comment start', 'declaration name', 'declaration set end', or 'whitespace'.
 • Did you forget a semicolon at the end of a line?
@davep
Copy link
Contributor

davep commented Feb 21, 2024

What does textual --version output?

@mohammad-sayed-ahmad
Copy link
Author

It outputs: textual, version 0.41.0.
I am trying to update it but I don't know how.

@davep
Copy link
Contributor

davep commented Feb 22, 2024

Not knowing your system or your environment or how you install your Python tools, it's hard to say; but this will be the cause of your problem: you have textual itself installed one way, and textual-dev installed another way, and it's older. Perhaps you have one installed into a virtual environment and the other installed globally?

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

No branches or pull requests

2 participants