It's possible that your h1 style is getting purged by Tailwind's styler purging process: https://tailwindcss.com/docs/controlling-file-size:
Using the @layer directive will also instruct Tailwind to consider
those styles for purging when purging the layer.
Since, presumably, you're not referencing the h1 style with @apply, maybe Tailwind is considering the style unused. Although, one would hope that Tailwind would not purge a tag-based selector.
Take a look at the CSS file that is built, either on the file system or inspector in the browser, and look for your h1 styles.
From the Tailwind docs, maybe try adding h1 to your whitelist - although I don't think it will work since the whitelist seems to want class-based selectors.
// tailwind.config.js
module.exports = {
purge: {
content: ['./src/**/*.html'],
// These options are passed through directly to PurgeCSS
options: {
whitelist: ['bg-red-500', 'px-4'],
}
},
// ...
}
I recommend asking if tag selectors work with layers on the Tailwind Discord or forum: https://tailwindcss.com/community
@tailwind base;before your@layer?@tailwind base; @tailwind components; @tailwind utilities;at the beginning of the file.