-
Notifications
You must be signed in to change notification settings - Fork 17
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
Theme fix - use style sources from theme instead from built-in #91
base: main
Are you sure you want to change the base?
Changes from 9 commits
dcb16ef
e9d6085
f79caf3
97d1362
1921ef2
d010690
50538e6
94278e9
4f3d2ce
868f54f
9faded6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ | |
""" | ||
from os import path | ||
|
||
import sass | ||
|
||
__version__ = '0.1.0' | ||
|
||
__version__ = '0.3.0' | ||
__version_full__ = __version__ | ||
|
||
|
||
|
@@ -14,10 +16,33 @@ def get_html_theme_path(): | |
return cur_dir | ||
|
||
|
||
def create_custom_css(app): | ||
|
||
def get_config_var(name, default): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep the doc_string of the original function here? |
||
return app.config.simplepdf_vars.get(name, default) | ||
|
||
def get_theme_var(name, default): | ||
return app.config.simplepdf_theme_options.get(name, default) | ||
|
||
here = path.abspath(path.dirname(__file__)) | ||
scss_folder = path.join(here, "static", "styles", "sources") | ||
|
||
staticdir = path.join(app.builder.outdir, "_static") | ||
|
||
sass.compile( | ||
dirname=(scss_folder, staticdir), | ||
output_style="nested", | ||
custom_functions={ | ||
sass.SassFunction("config", ("$a", "$b"), get_config_var), | ||
sass.SassFunction("theme_option", ("$a", "$b"), get_theme_var), | ||
}, | ||
) | ||
|
||
|
||
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package | ||
def setup(app): | ||
app.add_html_theme('simplepdf_theme', path.abspath(path.dirname(__file__))) | ||
# app.add_css_file('styles/main.css') | ||
app.connect('builder-inited', create_custom_css) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think with this line we call We should add a check inside |
||
|
||
return { | ||
"parallel_read_safe": True, | ||
|
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.
Here also: I would like to stay with
0.1.0
and raise it with an additional PR.