fix(schema): correctly set default cssnano config (#23980)

This commit is contained in:
Daniel Roe 2023-10-30 17:57:11 +09:00 committed by GitHub
parent 410cecd93e
commit 802cf7a1e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ export default defineUntypedSchema({
* Options for configuring PostCSS plugins. * Options for configuring PostCSS plugins.
* *
* https://postcss.org/ * https://postcss.org/
* @type {Record<string, any>} * @type {Record<string, any> & { autoprefixer?: any; cssnano?: any }}
*/ */
plugins: { plugins: {
/** /**
@ -14,14 +14,19 @@ export default defineUntypedSchema({
*/ */
autoprefixer: {}, autoprefixer: {},
/**
* https://cssnano.co/docs/config-file/#configuration-options
*/
cssnano: { cssnano: {
$resolve: async (val, get) => val ?? !(await get('dev') && { $resolve: async (val, get) => {
preset: ['default', { if (val || val === false) {
// Keep quotes in font values to prevent from HEX conversion return val
// https://github.com/nuxt/nuxt/issues/6306 }
minifyFontValues: { removeQuotes: false } if (await get('dev')) {
}] return false
}) }
return {}
}
} }
} }
} }