Skip to content

Commit 6e8d326

Browse files
committed
fix(@angular-devkit/build-angular): support string as plugin option in custom postcss plugin config
In certain cases, the plugin option may be a string value, as shown in the example below: ```json { "plugins": { "tailwindcss/nesting": "postcss-nesting" } } ``` In certain cases, the plugin option may be a string value, as shown in the example below: ```json { "plugins": { "tailwindcss/nesting": "postcss-nesting" } } ``` See: https://tailwindcss.com/docs/using-with-preprocessors#nesting
1 parent 0f84ae9 commit 6e8d326

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎packages/angular_devkit/build_angular/src/utils/postcss-configuration.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { readFile, readdir } from 'node:fs/promises';
1010
import { join } from 'node:path';
1111

1212
export interface PostcssConfiguration {
13-
plugins: [name: string, options?: object][];
13+
plugins: [name: string, options?: object | string][];
1414
}
1515

1616
interface RawPostcssConfiguration {
17-
plugins?: Record<string, object | boolean> | (string | [string, object])[];
17+
plugins?: Record<string, object | boolean | string> | (string | [string, object])[];
1818
}
1919

2020
const postcssConfigurationFiles: string[] = ['postcss.config.json', '.postcssrc.json'];
@@ -104,7 +104,7 @@ export async function loadPostcssConfiguration(
104104

105105
const config: PostcssConfiguration = { plugins: [] };
106106
for (const [name, options] of entries) {
107-
if (!options || typeof options !== 'object') {
107+
if (!options || (typeof options !== 'object' && typeof options !== 'string')) {
108108
continue;
109109
}
110110

0 commit comments

Comments
 (0)