Skip to content

Docs: Tailwind CSS configuration with Gatsby is missing some information #1099

@ashiishme

Description

@ashiishme

The installation guide of Tailwind CSS with Gatsby framework is missing some information that is required when someone creates a Gatsby theme with Tailwind CSS.

After following the installation guide, when running the project the build fails because Gatsby is not able to find the tailwind.config.js file in the project that depends on the Gatsby theme build with Tailwind CSS.

To reproduce:

  • Create a test Gatsby theme and configure Tailwind CSS as per the documentation.
  • Install the theme in a new Gatsby site
  • Start the server

Error:

ERROR in ../<theme-directory>/src/styles/global.css
Module build failed (from ../node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from 
../node_modules/gatsby-plugin-postcss/node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read properties of undefined (reading 'config')
    at getTailwindConfig
    ....

To fix this, we need to include the tailwind.config.js file in postcss.config.js.

I am interested to update the documentation with the relevant information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions