From b9f550e6e0bc11a4d1aa267500ea832503a22ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Mon, 31 Aug 2020 12:07:42 +0200 Subject: [PATCH] Use pyScss instead of libsass --- setup.py | 2 +- sphinx_book_theme/__init__.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 7512c7b6..a00050c1 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ "sphinx", "click", "setuptools", - "libsass", + "pyScss", "pydata-sphinx-theme~=0.3.0", "beautifulsoup4", ], diff --git a/sphinx_book_theme/__init__.py b/sphinx_book_theme/__init__.py index ded3f113..483a28bb 100644 --- a/sphinx_book_theme/__init__.py +++ b/sphinx_book_theme/__init__.py @@ -4,7 +4,7 @@ from docutils import nodes from sphinx.util import logging from bs4 import BeautifulSoup as bs -from sass import compile as sass_compile +from scss.compiler import compile_file from .launch import add_hub_urls @@ -27,9 +27,10 @@ def add_static_path(app): # Compile the css file if it's not been compiled already compiled_css_file = static_path / "sphinx-book-theme.css" if not compiled_css_file.exists(): - source_dir = str(static_path.parent / "scss") - output_dir = str(static_path) - sass_compile(dirname=(source_dir, output_dir), output_style="compressed") + source_file = str(static_path.parent / "scss" / "sphinx-book-theme.scss") + css = compile_file(source_file, output_style="compressed") + with open(compiled_css_file, "w") as f: + f.write(css) def find_url_relative_to_root(pagename, relative_page, path_docs_source):