tailwindlabs / tailwindcss-custom-forms

A better base for styling form elements with Tailwind CSS.
https://tailwindcss-custom-forms.netlify.app/
MIT License
1.55k stars 72 forks source link

"theme is not a function" error #65

Open jaobrown opened 4 years ago

jaobrown commented 4 years ago

I have a website built using tailwind—it is a Gatsby site, using postcss to handle tailwind.

Built the entire site with no issues—I installed custom-forms, and nothing will run—I just get a cryptic "theme is not a function" error. I can verify if I uninstall custom-forms, and remove from tailwind config plugins, it runs. Reinstall, add as a plugin, breaks.

Anyone had anything similar?

Thanks!

coderberry commented 4 years ago

I'm having the same issues.

danielt69 commented 4 years ago

tailwindcss v 1.5 - same here

adamwathan commented 4 years ago

Can someone share a simple GitHub repo that reproduces the issue? Better chance of me being finding 5 minutes to be able to look at it if I have a starting point instead of having to set it up from scratch.

jaobrown commented 4 years ago

Example Repo

https://github.com/jaobrown/gatsby-tailwind-custom-forms

@adamwathan error appears in this repo.

Steps to reproduce

  1. Clone repo
  2. npm install
  3. npm start

Expected result

Server runs

Results

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

theme is not a function

File: src/styles/main.scss

failed Building development bundle - 9.105s
IgorHalfeld commented 4 years ago

I put

 plugins: [
    require('@tailwindcss/custom-forms')
 ]

on tailwind.config.js instead of postcss.config.js and works for me 🎉

dospolov commented 4 years ago

fixed for me by updated gatsby-config.js from:

{
  resolve: `gatsby-plugin-sass`,
  options: {
     postCssPlugins: [require('tailwindcss'), require('./tailwind.config.js')]
  }
},

to:

{
  resolve: `gatsby-plugin-sass`,
  options: {
    postCssPlugins: [require('tailwindcss')('./tailwind.config.js')]
  }
},