Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support tailwind v4 #28939

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/angular/build/src/builders/application/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ async function getTailwindConfig(

if (!tailwindConfigurationPath) {
return undefined;
} else {
// TODO: Consider supporting tailwind v4 via vite
}

// Create a node resolver from the configuration file
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"karma": "^6.3.0",
"ng-packagr": "^19.0.0",
"protractor": "^7.0.0",
"tailwindcss": "^2.0.0 || ^3.0.0",
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
"typescript": ">=5.5 <5.7"
},
"peerDependenciesMeta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ export async function getStylesConfig(wco: WebpackConfigOptions): Promise<Config
extraPostcssPlugins.push(require(tailwindPackagePath)({ config: tailwindConfigPath }));
}
}
// Check for tailwind V4
// Tailwind V4 uses the new `@tailwindcss/postcss` package
try {
const tailwindPostCSSPackagePath = require.resolve('@tailwindcss/postcss', { paths: [root] });
try {
require.resolve('tailwindcss', { paths: [root] });
// Tailwind V4 is installed, add the plugin
extraPostcssPlugins.push(require(tailwindPostCSSPackagePath)());
} catch {
logger.warn(
`The '@tailwindcss/postcss' package is installed but the 'tailwindcss' package is not installed.` +
` To enable Tailwind CSS, please install the 'tailwindcss' package.`,
);
}
} catch {
// Tailwind V4 is not installed, no further action is needed
}

const autoprefixer: typeof import('autoprefixer') = require('autoprefixer');

Expand Down
Loading