Skip to content

Commit a7acb63

Browse files
authored
Merge pull request #78 from Point72/tkp/hf
Small hotfix for custom css and js
2 parents cc65c2f + b34c08c commit a7acb63

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

yardang/build.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,23 @@ def generate_docs_configuration(
7878
# if custom_css and custom_js are strings and they exist as paths, read them as Paths
7979
# otherwise, assume the content is directly provided
8080
if isinstance(custom_css, str):
81-
css_path = Path(custom_css)
82-
if css_path.exists():
83-
custom_css = css_path.read_text()
84-
elif isinstance(custom_css, Path):
81+
custom_css_path = Path(custom_css)
82+
# if the path is too long, it will throw
83+
try:
84+
if custom_css_path.exists():
85+
custom_css = custom_css_path.read_text()
86+
except OSError:
87+
pass
88+
else:
8589
custom_css = custom_css.read_text()
8690
if isinstance(custom_js, str):
87-
js_path = Path(custom_js)
88-
if js_path.exists():
89-
custom_js = js_path.read_text()
90-
elif isinstance(custom_js, Path):
91+
custom_js_path = Path(custom_js)
92+
try:
93+
if custom_js_path.exists():
94+
custom_js = custom_js_path.read_text()
95+
except OSError:
96+
pass
97+
else:
9198
custom_js = custom_js.read_text()
9299

93100
source_dir = os.path.curdir

0 commit comments

Comments
 (0)