Skip to content

Commit

Permalink
fix: handle SyntaxError for minify_html_onepass (#56)
Browse files Browse the repository at this point in the history
* fix: handle SyntaxError for minify_html_onepass

https://readthedocs.org/projects/dpdata/builds/24380201/

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
njzjz and pre-commit-ci[bot] authored May 14, 2024
1 parent 55f8ab4 commit e68e33b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion deepmodeling_sphinx/inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ def minify_html_files(app, pagename, templatename, context, doctree):

def render(self, template, render_context):
content = old_render(template, render_context)
return minify_html_onepass.minify(content, minify_js=True)
try:
return minify_html_onepass.minify(
content, minify_js=True, minify_css=True
)
except SyntaxError:
return content

render.__dict__.update(old_render.__dict__)
render._deepmodeling_minified = True
Expand Down

0 comments on commit e68e33b

Please sign in to comment.