little general improvement
This commit is contained in:
parent
4df9d5ddb3
commit
c523872baf
@ -195,7 +195,7 @@ def _compile_root_stylesheet(stylesheets: list[str]) -> str:
|
|||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
|
|
||||||
sass_compile = None
|
failed_to_import_sass = False
|
||||||
for stylesheet in stylesheets:
|
for stylesheet in stylesheets:
|
||||||
if not utils.is_valid_url(stylesheet):
|
if not utils.is_valid_url(stylesheet):
|
||||||
# check if stylesheet provided exists.
|
# check if stylesheet provided exists.
|
||||||
@ -229,7 +229,7 @@ def _compile_root_stylesheet(stylesheets: list[str]) -> str:
|
|||||||
Path.cwd()
|
Path.cwd()
|
||||||
/ constants.Dirs.WEB
|
/ constants.Dirs.WEB
|
||||||
/ constants.Dirs.STYLES
|
/ constants.Dirs.STYLES
|
||||||
/ RE_SASS_SCSS_EXT.sub(".css", str(stylesheet)).strip("/")
|
/ (stylesheet.rsplit(".", 1)[0].strip("/") + ".css")
|
||||||
)
|
)
|
||||||
target.parent.mkdir(parents=True, exist_ok=True)
|
target.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
@ -247,17 +247,17 @@ def _compile_root_stylesheet(stylesheets: list[str]) -> str:
|
|||||||
encoding="utf8",
|
encoding="utf8",
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sass_compile = None
|
failed_to_import_sass = True
|
||||||
else:
|
else:
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
f'The stylesheet file "{stylesheet_full_path}" is not a valid file.'
|
f'The stylesheet file "{stylesheet_full_path}" is not a valid file.'
|
||||||
)
|
)
|
||||||
|
|
||||||
stylesheet = f"./{str(stylesheet).replace(stylesheet_full_path.suffix, ".css").strip('/')}"
|
stylesheet = f"./{stylesheet.rsplit(".", 1)[0].strip("/")}.css"
|
||||||
|
|
||||||
sheets.append(stylesheet) if stylesheet not in sheets else None
|
sheets.append(stylesheet) if stylesheet not in sheets else None
|
||||||
|
|
||||||
if sass_compile is None:
|
if failed_to_import_sass:
|
||||||
console.error(
|
console.error(
|
||||||
'The `libsass` package is required to compile sass/scss stylesheet files. Run `pip install "libsass>=0.23.0"`.'
|
'The `libsass` package is required to compile sass/scss stylesheet files. Run `pip install "libsass>=0.23.0"`.'
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user