Skip to content

Commit

Permalink
chore: css work
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 22, 2023
1 parent 0d72d09 commit 437182a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions mknodes/theme/materialtheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class MaterialTheme(theme.Theme):
"""Material Theme."""

name = "material"
css_template = "material_css.jinja"

def __init__(self, **kwargs):
super().__init__(self.name, **kwargs)
Expand Down
10 changes: 7 additions & 3 deletions mknodes/theme/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
class Theme:
"""MkDocs Theme."""

css_template = None

def __init__(
self,
theme_name: str,
Expand All @@ -32,10 +34,12 @@ def __repr__(self):

def get_requirements(self):
req = []
if proj := self.associated_project:
if self.css_template and (proj := self.associated_project):
tmpl_ctx = self.get_template_context()
filename = "material_css.jinja"
css_text = proj.context.env.render_template(filename, variables=tmpl_ctx)
css_text = proj.context.env.render_template(
self.css_template,
variables=tmpl_ctx,
)
req = [requirements.CSSText("mknodes_theme.css", css_text)]
return requirements.Requirements(css=req, templates=list(self.templates))

Expand Down

0 comments on commit 437182a

Please sign in to comment.