changeset 1608:29eb1ea35869

taks (sass): replace deprecated `node-sass` by `sass`.
author Goffi <goffi@goffi.org>
date Fri, 31 May 2024 11:10:02 +0200
parents 64bfb6554131
children f3305832f3f6
files libervia/web/server/tasks/implicit/task_sass.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/web/server/tasks/implicit/task_sass.py	Thu May 30 23:56:05 2024 +0200
+++ b/libervia/web/server/tasks/implicit/task_sass.py	Fri May 31 11:10:02 2024 +0200
@@ -38,8 +38,8 @@
         except Exception as e:
             log.error(f"Unexepected exception while parsing package.json: {e}")
 
-        if 'node-sass' not in package.setdefault('dependencies', {}):
-            package['dependencies']['node-sass'] = '9.0.0'
+        if 'sass' not in package.setdefault('dependencies', {}):
+            package['dependencies']['sass'] = '^1.77'
             with package_path.open('w') as f:
                 json.dump(package, f, indent=4)
 
@@ -54,16 +54,17 @@
 
     async def start(self):
         d_path = self.resource.dev_build_path
-        node_sass = d_path / 'node_modules' / 'node-sass' / 'bin' / 'node-sass'
+        node_sass = d_path / 'node_modules' / 'sass' / 'sass.js'
         for browser_path in self.resource.browser_modules['themes_browser_paths']:
             for p in browser_path.iterdir():
                 if p.suffix not in SASS_SUFFIXES:
                     continue
                 await self.runCommand(
                     str(node_sass),
-                    "--omit-source-map-url",
-                    "--output-style", "compressed",
-                    "--output", str(self.build_path),
+                    "--load-path", str(self.build_path),
+                    "--no-source-map",
+                    "--style", "compressed",
                     str(p),
+                    str(self.build_path/p.with_suffix(".css").name),
                     path=str(self.build_path)
                 )