Blog Example with Tailwind Typography Plugin
Links
-
v0 Chat: https://v0.app/chat/blog-example-with-tailwind-rtlwUkTR2Pc
-
GitHub Repository: https://github.com/headline-design/v0-blog-example-with-tailwind
The Wild Workaround
This project demonstrates a fascinating (and somewhat absurd) workaround required due to a perfect storm of technical constraints:
-
v0 doesn’t support the Tailwind Typography plugin in its preview environment
-
Tailwind CSS v4 moved all configuration to CSS files (no more
tailwind.config.js) -
Next.js 16 doesn’t allow dynamic imports of CSS files at runtime
This confluence of limitations forced us to create a creative solution involving 4 separate styling files and conditional imports based on the deployment environment.
The Conditional Import Hack
In app/layout.tsx, you’ll find this unusual code:
if (process.env.VERCEL_URL && process.env.VERCEL_URL.includes("vusercontent.net")) {
import("@/app/styles/globals-only-index");
} else {
import("@/app/styles/globals-with-plugins-index");
}
What’s happening here?
-
When running in v0’s preview environment (detected by
vusercontent.netin the URL), we import the basic styles without the typography plugin -
When running in production on Vercel or locally, we import the full styles with the typography plugin
This allows the app to work in both environments despite v0’s limitations.
The Four Styling Files Explained
1. app/styles/globals.css
Purpose: The main stylesheet with all Tailwind v4 configuration and design tokens.
Contents:
-
Core Tailwind imports (
@import "tailwindcss") -
Custom design tokens (colors, spacing, radius)
-
Theme configuration using
@theme inline -
Base layer styles
Why it exists: This is the foundation that contains all the actual styling rules. It’s imported by both index files but never directly imported into the layout.
2. app/styles/typography-plugin.css
Purpose: A minimal file that imports the Tailwind Typography plugin.
Contents:
@import "tailwindcss";
@plugin "@tailwindcss/typography";
Why it exists: The typography plugin needs to be imported in a separate CSS file because:
-
Tailwind v4 requires plugins to be declared via
@pluginin CSS -
v0’s environment doesn’t support this plugin
-
We need to conditionally include it only in production
The problem it solves: By isolating the plugin import, we can choose whether to include it based on the environment.
3. app/styles/globals-only-index.tsx
Purpose: The import file for v0’s preview environment (WITHOUT typography plugin).
Contents:
//@ts-nocheck
import "./globals.css"
Why it exists:
-
Used when
VERCEL_URLcontainsvusercontent.net(v0’s preview) -
Only imports the base
globals.csswithout the typography plugin -
Allows the app to render in v0’s preview without errors
-
The
//@ts-nocheckcomment prevents TypeScript from complaining about the unusual import pattern
4. app/styles/globals-with-plugins-index.tsx
Purpose: The import file for production and local development (WITH typography plugin).
Contents:
//@ts-nocheck
// import plugin styles first for proper tree-shaking
import "./typography-plugin.css";
Why it exists:
-
Used in production deployments and local development
-
Imports the typography plugin CSS first for proper tree-shaking
-
Enables the
proseclasses for beautiful typography -
The comment about tree-shaking ensures the plugin styles are properly included in the build
Note: You might notice it doesn’t explicitly import globals.css - that’s because typography-plugin.css already imports tailwindcss, which processes all the styles. The order matters for proper CSS cascade and tree-shaking.
Why This Architecture?
This seemingly over-engineered solution solves several problems:
-
Environment Detection: The conditional import in
layout.tsxdetects whether we’re in v0’s preview or production -
Plugin Isolation: Separating the typography plugin into its own file allows us to conditionally include it
-
CSS Import Workaround: Using
.tsxfiles as import wrappers works around Next.js 16’s restriction on dynamic CSS imports -
Graceful Degradation: The app works in v0’s preview (without typography) and in production (with full typography support)
How to Use
Development
npm install
npm run dev
The app will run with full typography plugin support locally.
Deployment
Deploy to Vercel, and the typography plugin will automatically be included in production builds.
v0 Preview
Open the project in v0, and it will automatically use the simplified styles without the typography plugin.
Typography Plugin Usage
In production, you can use Tailwind’s typography classes:
<article className="prose lg:prose-xl">
<h1>Your Blog Post Title</h1>
<p>Beautiful, automatically styled content...</p>
</article>
The prose classes provide beautiful default styling for all HTML elements within the article.
Could This Be Simpler?
Yes, if any of these were true:
-
v0 supported the Tailwind Typography plugin
-
Tailwind v4 still used JavaScript config files
-
Next.js 16 allowed dynamic CSS imports
-
We didn’t need to support both v0 preview and production
But since we’re living in this specific moment of web development history, we get this beautiful Rube Goldberg machine of a solution! ![]()
Learn More
Built with
using v0, Next.js 16, and a healthy dose of creative problem-solving.