2023-01-30 12:09:48 +00:00
|
|
|
import { defu } from 'defu'
|
2022-02-25 19:11:01 +00:00
|
|
|
import createResolver from 'postcss-import-resolver'
|
2022-08-26 15:47:29 +00:00
|
|
|
import { defineUntypedSchema } from 'untyped'
|
2022-02-25 19:11:01 +00:00
|
|
|
|
2022-08-26 15:47:29 +00:00
|
|
|
export default defineUntypedSchema({
|
2022-02-25 19:11:01 +00:00
|
|
|
postcss: {
|
|
|
|
/**
|
|
|
|
* Options for configuring PostCSS plugins.
|
|
|
|
*
|
|
|
|
* https://postcss.org/
|
2022-02-28 11:28:16 +00:00
|
|
|
* @type {Record<string, any>}
|
2022-02-25 19:11:01 +00:00
|
|
|
*/
|
|
|
|
plugins: {
|
|
|
|
/**
|
|
|
|
* https://github.com/postcss/postcss-import
|
|
|
|
*/
|
|
|
|
'postcss-import': {
|
2022-09-12 18:22:41 +00:00
|
|
|
$resolve: async (val, get) => val !== false ? defu(val || {}, {
|
2022-02-25 19:11:01 +00:00
|
|
|
resolve: createResolver({
|
2022-09-12 18:22:41 +00:00
|
|
|
alias: { ...(await get('alias')) },
|
2022-02-25 19:11:01 +00:00
|
|
|
modules: [
|
2022-09-12 18:22:41 +00:00
|
|
|
await get('srcDir'),
|
|
|
|
await get('rootDir'),
|
|
|
|
...(await get('modulesDir'))
|
2022-02-25 19:11:01 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
}) : val,
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* https://github.com/postcss/postcss-url
|
|
|
|
*/
|
|
|
|
'postcss-url': {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* https://github.com/postcss/autoprefixer
|
|
|
|
*/
|
|
|
|
autoprefixer: {},
|
|
|
|
|
|
|
|
cssnano: {
|
2022-09-12 18:22:41 +00:00
|
|
|
$resolve: async (val, get) => val ?? !(await get('dev') && {
|
2022-02-25 19:11:01 +00:00
|
|
|
preset: ['default', {
|
|
|
|
// Keep quotes in font values to prevent from HEX conversion
|
2023-01-20 13:37:41 +00:00
|
|
|
// https://github.com/nuxt/nuxt/issues/6306
|
2022-02-25 19:11:01 +00:00
|
|
|
minifyFontValues: { removeQuotes: false }
|
|
|
|
}]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-26 15:47:29 +00:00
|
|
|
})
|