From 8867bf2959aa1f04bd85c13347f4cd11e31d18d2 Mon Sep 17 00:00:00 2001 From: MeAkib Date: Wed, 28 Oct 2026 20:08:07 +0600 Subject: [PATCH 1/5] fix(@schematics/angular): update the PostCSS configuration used by the build in tailwind The tailwind schematic searched the workspace root before the project root and `.postcssrc.json` before `postcss.config.json`, the opposite of the build system. With a configuration in both locations, the schematic added `@tailwindcss/postcss` to a file the build never reads, so the build succeeded but Tailwind CSS utilities were not generated. Search the project root first and `postcss.config.json` first, matching the build system. --- packages/schematics/angular/tailwind/index.ts | 5 +++-- .../schematics/angular/tailwind/index_spec.ts | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/schematics/angular/tailwind/index.ts b/packages/schematics/angular/tailwind/index.ts index 540b38310178..855c776df0d0 100644 --- a/packages/schematics/angular/tailwind/index.ts +++ b/packages/schematics/angular/tailwind/index.ts @@ -34,7 +34,8 @@ import { createProjectSchematic } from '../utility/project'; import { Schema as TailwindOptions } from './schema'; const TAILWIND_DEPENDENCIES = ['tailwindcss', '@tailwindcss/postcss', 'postcss']; -const POSTCSS_CONFIG_FILES = ['.postcssrc.json', 'postcss.config.json']; +// Same lookup order as the build system, so the configuration that gets updated is the one used. +const POSTCSS_CONFIG_FILES = ['postcss.config.json', '.postcssrc.json']; function addTailwindStyles(options: { project: string }, project: ProjectDefinition): Rule { return async (tree) => { @@ -94,7 +95,7 @@ function addTailwindStyles(options: { project: string }, project: ProjectDefinit function managePostCssConfiguration(project: ProjectDefinition): Rule { return async (tree) => { - const searchPaths = ['/', project.root]; // Workspace root and project root + const searchPaths = [project.root, '/']; // Project root and workspace root for (const path of searchPaths) { for (const configFile of POSTCSS_CONFIG_FILES) { diff --git a/packages/schematics/angular/tailwind/index_spec.ts b/packages/schematics/angular/tailwind/index_spec.ts index b55d76fff385..8b13fb762bd7 100644 --- a/packages/schematics/angular/tailwind/index_spec.ts +++ b/packages/schematics/angular/tailwind/index_spec.ts @@ -128,6 +128,28 @@ describe('Tailwind Schematic', () => { expect(postCssConfig.plugins['autoprefixer']).toBeDefined(); expect(tree.exists('/projects/bar/.postcssrc.json')).toBe(false); }); + + it('should prefer a project root configuration over a workspace root configuration', async () => { + appTree.create('/.postcssrc.json', JSON.stringify({ plugins: {} })); + appTree.create('/projects/bar/postcss.config.json', JSON.stringify({ plugins: {} })); + const tree = await schematicRunner.runSchematic('tailwind', { project: 'bar' }, appTree); + + const projectConfig = JSON.parse(tree.readContent('/projects/bar/postcss.config.json')); + expect(projectConfig.plugins['@tailwindcss/postcss']).toBeDefined(); + const workspaceConfig = JSON.parse(tree.readContent('/.postcssrc.json')); + expect(workspaceConfig.plugins['@tailwindcss/postcss']).toBeUndefined(); + }); + + it('should prefer postcss.config.json over .postcssrc.json in the same directory', async () => { + appTree.create('/projects/bar/.postcssrc.json', JSON.stringify({ plugins: {} })); + appTree.create('/projects/bar/postcss.config.json', JSON.stringify({ plugins: {} })); + const tree = await schematicRunner.runSchematic('tailwind', { project: 'bar' }, appTree); + + const config = JSON.parse(tree.readContent('/projects/bar/postcss.config.json')); + expect(config.plugins['@tailwindcss/postcss']).toBeDefined(); + const rcConfig = JSON.parse(tree.readContent('/projects/bar/.postcssrc.json')); + expect(rcConfig.plugins['@tailwindcss/postcss']).toBeUndefined(); + }); }); describe('with non-workspace stylesheets', () => { From 6735776847776cd41b86ff17dd69234223641472 Mon Sep 17 00:00:00 2001 From: Shuaib Hasan Akib <48770016+MeAkib@users.noreply.github.com> Date: Wed, 28 Oct 2026 22:05:45 +0600 Subject: [PATCH 2/5] fixup! fix(@schematics/angular): update the PostCSS configuration used by the build in tailwind --- packages/schematics/angular/tailwind/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schematics/angular/tailwind/index.ts b/packages/schematics/angular/tailwind/index.ts index 855c776df0d0..26517b2ef8a9 100644 --- a/packages/schematics/angular/tailwind/index.ts +++ b/packages/schematics/angular/tailwind/index.ts @@ -95,7 +95,7 @@ function addTailwindStyles(options: { project: string }, project: ProjectDefinit function managePostCssConfiguration(project: ProjectDefinition): Rule { return async (tree) => { - const searchPaths = [project.root, '/']; // Project root and workspace root + const searchPaths = Array.from(new Set([join('/', project.root), '/'])); for (const path of searchPaths) { for (const configFile of POSTCSS_CONFIG_FILES) { From 46e0547f362d2a77cae26c91c00fd52e8e3ac1a3 Mon Sep 17 00:00:00 2001 From: Shuaib Hasan Akib <48770016+MeAkib@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:02:39 +0600 Subject: [PATCH 3/5] fixup! fix(@schematics/angular): update the PostCSS configuration used by the build in tailwind Co-authored-by: Alan Agius --- packages/schematics/angular/tailwind/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schematics/angular/tailwind/index.ts b/packages/schematics/angular/tailwind/index.ts index 26517b2ef8a9..855c776df0d0 100644 --- a/packages/schematics/angular/tailwind/index.ts +++ b/packages/schematics/angular/tailwind/index.ts @@ -95,7 +95,7 @@ function addTailwindStyles(options: { project: string }, project: ProjectDefinit function managePostCssConfiguration(project: ProjectDefinition): Rule { return async (tree) => { - const searchPaths = Array.from(new Set([join('/', project.root), '/'])); + const searchPaths = [project.root, '/']; // Project root and workspace root for (const path of searchPaths) { for (const configFile of POSTCSS_CONFIG_FILES) { From 70843cb28d83e3b1344c437ef924624e3efef84d Mon Sep 17 00:00:00 2001 From: Shuaib Hasan Akib <48770016+MeAkib@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:03:29 +0600 Subject: [PATCH 4/5] fixup! fix(@schematics/angular): update the PostCSS configuration used by the build in tailwind Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/schematics/angular/tailwind/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schematics/angular/tailwind/index.ts b/packages/schematics/angular/tailwind/index.ts index 855c776df0d0..26517b2ef8a9 100644 --- a/packages/schematics/angular/tailwind/index.ts +++ b/packages/schematics/angular/tailwind/index.ts @@ -95,7 +95,7 @@ function addTailwindStyles(options: { project: string }, project: ProjectDefinit function managePostCssConfiguration(project: ProjectDefinition): Rule { return async (tree) => { - const searchPaths = [project.root, '/']; // Project root and workspace root + const searchPaths = Array.from(new Set([join('/', project.root), '/'])); for (const path of searchPaths) { for (const configFile of POSTCSS_CONFIG_FILES) { From 53787897a690dd1fdf96bd4af2c532f9f3281b04 Mon Sep 17 00:00:00 2001 From: Shuaib Hasan Akib <48770016+MeAkib@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:18:09 +0600 Subject: [PATCH 5/5] fixup! fix(@schematics/angular): update the PostCSS configuration used by the build in tailwind Co-authored-by: Alan Agius --- packages/schematics/angular/tailwind/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schematics/angular/tailwind/index.ts b/packages/schematics/angular/tailwind/index.ts index 26517b2ef8a9..002160d1eb33 100644 --- a/packages/schematics/angular/tailwind/index.ts +++ b/packages/schematics/angular/tailwind/index.ts @@ -95,7 +95,7 @@ function addTailwindStyles(options: { project: string }, project: ProjectDefinit function managePostCssConfiguration(project: ProjectDefinition): Rule { return async (tree) => { - const searchPaths = Array.from(new Set([join('/', project.root), '/'])); + const searchPaths = new Set([join('/', project.root), '/']); for (const path of searchPaths) { for (const configFile of POSTCSS_CONFIG_FILES) {