From 7ef80aa7b18ae67af3399e1916502bcf5c4b9827 Mon Sep 17 00:00:00 2001 From: mph Date: Wed, 4 Dec 2024 18:04:56 -0800 Subject: [PATCH 1/3] Configure vite css pre-processor options Pass options to the scss pre-processor to silence deprecation warnings. --- packages/11ty/_plugins/vite/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/11ty/_plugins/vite/index.js b/packages/11ty/_plugins/vite/index.js index e3c97c8a6..cc4583ada 100644 --- a/packages/11ty/_plugins/vite/index.js +++ b/packages/11ty/_plugins/vite/index.js @@ -75,6 +75,19 @@ module.exports = function (eleventyConfig, { directoryConfig, publication }) { }, sourcemap: true }, + /** + * Configure style pre-procssing + * @see https://vite.dev/config/shared-options#css-preprocessoroptions + * @see https://sass-lang.com/documentation/js-api/interfaces/options/ + */ + css: { + preprocessorOptions: { + scss: { + api: 'modern-compiler', + quietDeps: true, + } + } + }, /** * Set to false to prevent Vite from clearing the terminal screen * and have Vite logging messages rendered alongside Eleventy output. From 3a3df7e9cecba8c22819bcb37bea6cde3c7bce42 Mon Sep 17 00:00:00 2001 From: mph Date: Wed, 11 Dec 2024 12:14:48 -0800 Subject: [PATCH 2/3] Pass silenceDeprecation option to sass compiler --- .../11ty/_plugins/transforms/outputs/pdf/write.js | 13 ++++++++++--- packages/11ty/_plugins/vite/index.js | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/11ty/_plugins/transforms/outputs/pdf/write.js b/packages/11ty/_plugins/transforms/outputs/pdf/write.js index c97572aca..d50defe9b 100644 --- a/packages/11ty/_plugins/transforms/outputs/pdf/write.js +++ b/packages/11ty/_plugins/transforms/outputs/pdf/write.js @@ -57,9 +57,16 @@ module.exports = (eleventyConfig) => { } const sassOptions = { - loadPaths: [ - path.resolve('node_modules') - ] + api: 'modern-compiler', + loadPaths: [path.resolve('node_modules')], + // logger: { + // warn(message, options) { + // if (options.deprecation) return; + // console.warn('Warning: %O', message) + // } + // }, + quietDeps: true, + silenceDeprecations: ['color-functions', 'import', 'mixed-decls'] } try { diff --git a/packages/11ty/_plugins/vite/index.js b/packages/11ty/_plugins/vite/index.js index cc4583ada..6798d9ae9 100644 --- a/packages/11ty/_plugins/vite/index.js +++ b/packages/11ty/_plugins/vite/index.js @@ -84,7 +84,13 @@ module.exports = function (eleventyConfig, { directoryConfig, publication }) { preprocessorOptions: { scss: { api: 'modern-compiler', - quietDeps: true, + logger: { + warn(message, options) { + if (options.deprecation) return; + console.warn('Warning: %O', message) + } + }, + silenceDeprecations: ['color-functions', 'import', 'mixed-decls'] } } }, From b74523f9bbf4cbd17cea2013b15fb9a8cda4ebd6 Mon Sep 17 00:00:00 2001 From: mph Date: Wed, 11 Dec 2024 12:56:51 -0800 Subject: [PATCH 3/3] Ensure options are passed to the sass compiler --- .../11ty/_includes/components/lightbox/styles.js | 13 ++++++++++++- .../_plugins/transforms/outputs/epub/index.js | 10 ++++++++-- .../11ty/_plugins/transforms/outputs/pdf/write.js | 15 +++++++-------- packages/11ty/_plugins/vite/index.js | 14 +++++++------- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/packages/11ty/_includes/components/lightbox/styles.js b/packages/11ty/_includes/components/lightbox/styles.js index 2f88a10f1..8fdeee919 100644 --- a/packages/11ty/_includes/components/lightbox/styles.js +++ b/packages/11ty/_includes/components/lightbox/styles.js @@ -20,7 +20,18 @@ module.exports = function (eleventyConfig) { if (!fs.existsSync(lightboxStylesPath)) { logger.warn(`q-lightbox component styles were not found at ${lightboxStylesPath}, this may cause the lightbox to behave unexpectedly.`) } else { - lightboxCSS = sass.compile(lightboxStylesPath) + const sassOptions = { + api: 'modern-compiler', + loadPaths: [path.resolve('node_modules')], + silenceDeprecations: [ + 'color-functions', + 'global-builtin', + 'import', + 'legacy-js-api', + 'mixed-decls' + ] + } + lightboxCSS = sass.compile(lightboxStylesPath, sassOptions) } return function () { diff --git a/packages/11ty/_plugins/transforms/outputs/epub/index.js b/packages/11ty/_plugins/transforms/outputs/epub/index.js index 8a93169f1..39f356f1d 100644 --- a/packages/11ty/_plugins/transforms/outputs/epub/index.js +++ b/packages/11ty/_plugins/transforms/outputs/epub/index.js @@ -43,8 +43,14 @@ module.exports = (eleventyConfig, collections) => { * Copy styles */ const sassOptions = { - loadPaths: [ - path.resolve('node_modules') + api: 'modern-compiler', + loadPaths: [path.resolve('node_modules')], + silenceDeprecations: [ + 'color-functions', + 'global-builtin', + 'import', + 'legacy-js-api', + 'mixed-decls' ] } const styles = sass.compile(path.resolve('content', assetsDir, 'styles', 'epub.scss'), sassOptions) diff --git a/packages/11ty/_plugins/transforms/outputs/pdf/write.js b/packages/11ty/_plugins/transforms/outputs/pdf/write.js index d50defe9b..aaaf778d6 100644 --- a/packages/11ty/_plugins/transforms/outputs/pdf/write.js +++ b/packages/11ty/_plugins/transforms/outputs/pdf/write.js @@ -59,14 +59,13 @@ module.exports = (eleventyConfig) => { const sassOptions = { api: 'modern-compiler', loadPaths: [path.resolve('node_modules')], - // logger: { - // warn(message, options) { - // if (options.deprecation) return; - // console.warn('Warning: %O', message) - // } - // }, - quietDeps: true, - silenceDeprecations: ['color-functions', 'import', 'mixed-decls'] + silenceDeprecations: [ + 'color-functions', + 'global-builtin', + 'import', + 'legacy-js-api', + 'mixed-decls' + ] } try { diff --git a/packages/11ty/_plugins/vite/index.js b/packages/11ty/_plugins/vite/index.js index 6798d9ae9..cc0a13e7b 100644 --- a/packages/11ty/_plugins/vite/index.js +++ b/packages/11ty/_plugins/vite/index.js @@ -84,13 +84,13 @@ module.exports = function (eleventyConfig, { directoryConfig, publication }) { preprocessorOptions: { scss: { api: 'modern-compiler', - logger: { - warn(message, options) { - if (options.deprecation) return; - console.warn('Warning: %O', message) - } - }, - silenceDeprecations: ['color-functions', 'import', 'mixed-decls'] + silenceDeprecations: [ + 'color-functions', + 'global-builtin', + 'import', + 'legacy-js-api', + 'mixed-decls' + ] } } },