mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(cli): allow custom postcss autoprefixer (#8913)
This commit is contained in:
parent
673c71218b
commit
475646752b
@ -2,7 +2,7 @@ import { existsSync } from 'fs-extra';
|
|||||||
import { ROOT_POSTCSS_CONFIG_FILE } from '../common/constant';
|
import { ROOT_POSTCSS_CONFIG_FILE } from '../common/constant';
|
||||||
|
|
||||||
type PostcssConfig = {
|
type PostcssConfig = {
|
||||||
plugins?: Record<string, unknown> | unknown[];
|
plugins?: Record<string, unknown> | any[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getRootPostcssConfig(): PostcssConfig {
|
export function getRootPostcssConfig(): PostcssConfig {
|
||||||
@ -16,6 +16,13 @@ function getPostcssPlugins(rootConfig: PostcssConfig) {
|
|||||||
const plugins = rootConfig.plugins || [];
|
const plugins = rootConfig.plugins || [];
|
||||||
|
|
||||||
if (Array.isArray(plugins)) {
|
if (Array.isArray(plugins)) {
|
||||||
|
const hasPostcssPlugin = plugins.find(
|
||||||
|
(plugin) =>
|
||||||
|
plugin === 'autoprefixer' && plugin.postcssPlugin === 'autoprefixer'
|
||||||
|
);
|
||||||
|
if (hasPostcssPlugin) {
|
||||||
|
return plugins;
|
||||||
|
}
|
||||||
return [require('autoprefixer'), ...plugins];
|
return [require('autoprefixer'), ...plugins];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user