Skip to content
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
37 changes: 37 additions & 0 deletions plugins/development/plugin-palette/src/node/palettePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { addViteConfig, chainWebpack } from '@vuepress/helper'
import { watch } from 'chokidar'
import type { Plugin } from 'vuepress/core'
import { preparePaletteFile } from './preparePaletteFile.js'
Expand Down Expand Up @@ -90,6 +91,42 @@ export const palettePlugin = ({
'@vuepress/plugin-palette/style': app.dir.temp(tempStyleFile),
}),

extendsBundlerOptions: (bundlerOptions, app) => {
if (preset !== 'sass') return

// silent import deprecation for vite
addViteConfig(bundlerOptions, app, {
css: {
preprocessorOptions: {
sass: {
silenceDeprecations: ['import'],
},
scss: {
silenceDeprecations: ['import'],
},
},
},
})
// silent import deprecation for webpack
chainWebpack(bundlerOptions, app, (webpackOptions) => {
webpackOptions.module
.rule('scss')
.use('sass-loader')
.tap((loaderOptions) => ({
...loaderOptions,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
sassOptions: {
...loaderOptions.sassOptions,
silenceDeprecations: [
'import',
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
...(loaderOptions.sassOptions?.silenceDeprecations ?? []),
],
},
}))
})
},

onPrepared: async (app) => {
await Promise.all([
preparePaletteFile(app, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const sassPalettePlugin =
},

extendsBundlerOptions: (bundlerOptions: unknown): void => {
// switch to modern api and silent import deprecation for vite
// silent import deprecation for vite
addViteConfig(bundlerOptions, app, {
css: {
preprocessorOptions: {
Expand Down
2 changes: 1 addition & 1 deletion themes/theme-default/src/client/styles/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* stylelint-disable scss/dollar-variable-pattern */
@forward '@vuepress/plugin-palette/palette';
@import '@vuepress/plugin-palette/palette';

// responsive breakpoints
$MQNarrow: 959px !default;
Expand Down
Loading