From 8bd96bf09c3549307b7390e647975cc14099ed54 Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 17 Sep 2026 18:58:25 +0200 Subject: [PATCH] fixed vite deprecated warnings --- .../assets/fonts/epilogue/stylesheet.css | 20 ----------------- .../assets/fonts/epilogue/stylesheet.scss | 22 +++++++++++++++++++ .../custom/leshed/assets/scss/main.scss | 8 +++---- .../leshed/assets/scss/partials/fonts.scss | 5 ++--- .../leshed/assets/scss/partials/mixins.scss | 2 ++ web/themes/custom/leshed/vite.config.js | 10 +++++++++ 6 files changed, 40 insertions(+), 27 deletions(-) delete mode 100644 web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.css create mode 100644 web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.scss diff --git a/web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.css b/web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.css deleted file mode 100644 index 5e06135..0000000 --- a/web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.css +++ /dev/null @@ -1,20 +0,0 @@ - - -@font-face { - font-family: 'Epilogue'; - src: url('Epilogue-Italic-VariableFont_wght.ttf') format('truetype'); - src: url('Epilogue-Italic-VariableFont_wght.ttf') format('truetype') tech(variations); - font-weight: 100 900; - font-style: italic; - font-display: block; -} - -@font-face { - font-family: 'Epilogue'; - src: url('Epilogue-VariableFont_wght.ttf') format('truetype'); - src: url('Epilogue-VariableFont_wght.ttf') format('truetype') tech(variations); - font-weight: 100 900; - font-style: normal; - font-display: block; -} - diff --git a/web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.scss b/web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.scss new file mode 100644 index 0000000..ee92170 --- /dev/null +++ b/web/themes/custom/leshed/assets/fonts/epilogue/stylesheet.scss @@ -0,0 +1,22 @@ +// Chemin vers ce dossier, relatif au fichier d'entrée Sass du projet +// consommateur (Vite résout les url() d'un partial par rapport à l'entrée, +// pas par rapport à ce fichier) : à fixer via `@use ... with ($font-path: ...)`. +$font-path: '.' !default; + +@font-face { + font-family: 'Epilogue'; + src: url('#{$font-path}/Epilogue-Italic-VariableFont_wght.ttf') format('truetype'); + src: url('#{$font-path}/Epilogue-Italic-VariableFont_wght.ttf') format('truetype') tech(variations); + font-weight: 100 900; + font-style: italic; + font-display: block; +} + +@font-face { + font-family: 'Epilogue'; + src: url('#{$font-path}/Epilogue-VariableFont_wght.ttf') format('truetype'); + src: url('#{$font-path}/Epilogue-VariableFont_wght.ttf') format('truetype') tech(variations); + font-weight: 100 900; + font-style: normal; + font-display: block; +} diff --git a/web/themes/custom/leshed/assets/scss/main.scss b/web/themes/custom/leshed/assets/scss/main.scss index 0d37139..242826c 100644 --- a/web/themes/custom/leshed/assets/scss/main.scss +++ b/web/themes/custom/leshed/assets/scss/main.scss @@ -1,7 +1,7 @@ -@import "partials/variables"; -@import "partials/colors"; -@import "partials/fonts"; -@import "partials/mixins"; +@use "partials/variables" as *; +@use "partials/colors" as *; +@use "partials/fonts" as *; +@use "partials/mixins" as *; a, a:visited{ text-decoration: none; diff --git a/web/themes/custom/leshed/assets/scss/partials/fonts.scss b/web/themes/custom/leshed/assets/scss/partials/fonts.scss index afc23ed..33417c5 100644 --- a/web/themes/custom/leshed/assets/scss/partials/fonts.scss +++ b/web/themes/custom/leshed/assets/scss/partials/fonts.scss @@ -1,5 +1,4 @@ -@import "/assets/fonts/epilogue/stylesheet.css"; - +@use "../../fonts/epilogue/stylesheet" with ($font-path: "../fonts/epilogue"); body{ font-family: 'Epilogue'; @@ -8,7 +7,7 @@ body{ } @mixin titre{ - + font-size: 1em; } // @mixin titre_h2{ diff --git a/web/themes/custom/leshed/assets/scss/partials/mixins.scss b/web/themes/custom/leshed/assets/scss/partials/mixins.scss index 7ef1bc9..45df48e 100644 --- a/web/themes/custom/leshed/assets/scss/partials/mixins.scss +++ b/web/themes/custom/leshed/assets/scss/partials/mixins.scss @@ -1,3 +1,5 @@ +@use "colors" as *; + @mixin menu-contenus{ ul,li{ padding: 0; diff --git a/web/themes/custom/leshed/vite.config.js b/web/themes/custom/leshed/vite.config.js index fa011b3..5d1a9fe 100644 --- a/web/themes/custom/leshed/vite.config.js +++ b/web/themes/custom/leshed/vite.config.js @@ -5,6 +5,16 @@ import { fileURLToPath, URL } from 'node:url' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], + css: { + preprocessorOptions: { + scss: { + // Fait taire le DEPRECATION WARNING [legacy-js-api] de Vite : la + // "sass" installée (pure JS) supporte l'API moderne sans dépendre + // de sass-embedded. + api: 'modern', + }, + }, + }, // Chemins relatifs dans les assets buildés (main.css -> fonts/...) : sinon // Vite génère des url() absolues depuis la racine du site ("/fonts/...") // au lieu du dossier du thème, où Drupal sert réellement assets/dist/.