Skip to content

Add id to stylesheet element #84

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

Merged

Conversation

GDWR
Copy link
Contributor

@GDWR GDWR commented Feb 7, 2022

Adds an id attribute to the CSS stylesheet so it can be easily queried.

The default theme is set to "bulma-css"
if there is a theme it is set to "bulma-css-{theme}"

@@ -30,7 +30,7 @@ def bulma(theme: str = "") -> SafeString:
css = static(f"css/{theme + '_' if theme else ''}bulma.css")
html = [
f'<link rel="preload" href="{css}" as="style">',
f'<link rel="stylesheet" href="{css}">',
f'<link rel="stylesheet" href="{css}" id="bulma-css{"" if theme == "" else f"-{theme}"}">',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can refactor this so it doesn't give people a heart attack? 🌞

Maybe this id can be created on an earlier line so that we don't have to have an f string within an f string with a ternary conditional, that's a lot of logic to stuff into one line.

@lemonsaurus lemonsaurus merged commit f93388f into lemonsaurus:main Feb 8, 2022
@GDWR GDWR deleted the gdwr/add_id_to_stylesheet_element branch February 9, 2022 10:43
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

Successfully merging this pull request may close these issues.

2 participants