My site works perfectly in development, but when I try building it, the resulting site has a large portion of CSS rules totally missing. Most of the broken CSS is in the header and footer of my wrapPageElement
. Inside my layout, the header and footer background and text colors go white, and centering and widths are gone, but the fonts, font sizes, and hover styles are still working.
Upon inspecting the page, I can see that all the rules for my own classes are gone, as well as most of the CSS rules for Tailwind itself. I have no network errors or missing files. Most of my CSS rules are just not getting included in a production build, but it all works perfectly in development.
[
`gatsby-plugin-eslint`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-tailwind`,
short_name: `starter`,
start_url: `/`,
background_color: fullConfig.theme.colors.white,
theme_color: fullConfig.theme.colors.teal["400"],
display: `minimal-ui`,
icon: `src/images/tailwind-icon.png`,
},
},
{
resolve: `gatsby-plugin-postcss`,
options: {
postCssPlugins: [
require(`tailwindcss`)(tailwindConfig),
require(`autoprefixer`),
...(process.env.NODE_ENV === `production`
? [require(`cssnano`)]
: []),
],
},
},
{
resolve: `gatsby-source-wordpress-experimental`,
options: {
url: `https://wp.example.com/graphql`,
html: {
createStaticFiles: true
}
},
},
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
`gatsby-plugin-offline`,
]
import React from 'react';
import { Layout } from './src/components/Layout/Layout';
import './src/css/style.css';
export const wrapPageElement = ({ element, props }) => {
return (
<Layout
title="Home"
keywords={[`gatsby`, `tailwind`, `react`, `tailwindcss`]}
>
{ element }
</Layout>
);
};