Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Sass options to silence deprecation warnings #976

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/11ty/_includes/components/lightbox/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
10 changes: 8 additions & 2 deletions packages/11ty/_plugins/transforms/outputs/epub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions packages/11ty/_plugins/transforms/outputs/pdf/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ module.exports = (eleventyConfig) => {
}

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'
]
}

Expand Down
19 changes: 19 additions & 0 deletions packages/11ty/_plugins/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@ 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',
silenceDeprecations: [
'color-functions',
'global-builtin',
'import',
'legacy-js-api',
'mixed-decls'
]
}
}
},
/**
* Set to false to prevent Vite from clearing the terminal screen
* and have Vite logging messages rendered alongside Eleventy output.
Expand Down