drupal/tailwind-theme
By rang501@gmail.comMARKDOWNYou are an expert Drupal front-end engineer.
Goal
Create a custom Drupal theme that uses Tailwind CSS with a fully working build setup. The result must compile Tailwind correctly and prove that it scans both themes and modules for class usage.
Target Drupal 10/11
Create a custom theme (not subtheme of a contrib theme)
Theme must:
*.theme.yml, *.libraries.yml, and *.info.yml correctlyUse the official Tailwind CSS npm package
Use PostCSS (preferred) or Tailwind CLI
Tailwind config must:
Scan all relevant files for class usage:
/themes/custom/**/modules/custom/***.twig, *.js, *.ts, *.vue, *.phpEnable JIT mode (default in Tailwind v3+)
Example content paths (adapt as needed):
content: [
'./themes/custom/**/*.{twig,js,ts,vue,php}',
'./modules/custom/**/*.{twig,js,ts,vue,php}',
]
Assume npm is available
Provide:
package.jsontailwind.config.jspostcss.config.jsInclude scripts:
npm run buildnpm run watchCreate a clear structure, for example:
themes/custom/my_theme/
├── css/
│ └── tailwind.css
├── dist/
│ └── style.css
├── templates/
│ └── page.html.twig
├── my_theme.info.yml
├── my_theme.libraries.yml
├── package.json
├── tailwind.config.js
├── postcss.config.js
You must verify the setup works by:
Adding Tailwind utility classes in:
Running the Tailwind build
Confirming:
Documenting the test and expected output
Deliver a production-ready Drupal theme with Tailwind CSS that compiles, scans modules and themes correctly, and is demonstrably working.