Introduction
11ty-tailwind-jit is a starter project that combines Eleventy (11ty) static site generator with Tailwind CSS using the Just-In-Time (JIT) compiler. This setup allows for an incredibly fast development experience, enabling real-time CSS updates as you type changes into your templates. It's particularly useful for developers new to Tailwind CSS who want to experiment with different utility classes and see immediate results.
Main Features
- Real-time CSS updates using Tailwind JIT compiler
- Fast development experience with instant feedback
- Easy integration with Eleventy (11ty) static site generator
- Simplified Tailwind configuration
- Live example hosted on Netlify
- Customizable Tailwind theme
- Environment-aware build process
- Watchable CSS file for Eleventy
- Version shortcode for browser CSS refresh
Installation Steps
Clone the repository:
git clone https://github.com/kkgthb/11ty-tailwind-jit.git
Navigate to the project directory:
cd 11ty-tailwind-jit
Install dependencies:
npm install
Start the development server:
npm run start
Usage Instructions
Edit Tailwind classes in your Eleventy templates (e.g., in the
src
directory).Observe real-time updates in your browser as you make changes.
Customize the Tailwind configuration in
/src/tailwind/tailwind.config.js
if needed.Add new templates and pages using Eleventy's file structure.
Use the
{% version %}
shortcode in your templates to ensure browser CSS refreshes.For production builds, set the
NODE_ENV
environment variable toproduction
.Deploy your site to a platform like Netlify for easy hosting and continuous deployment.
Important Notes
If changes stop taking effect during development, restart the server once or twice.
Ensure the
NODE_ENV
environment variable is set to eitherproduction
ordevelopment
for proper functionality.The project uses a custom PostCSS configuration for integrating Tailwind with Eleventy.
The
.eleventy.js
file includes important configurations for watching Tailwind CSS changes.This starter can be adapted to other projects by copying specific files and dependencies.
The live example is hosted on Netlify and can be accessed for reference.
The project is open-source and welcomes contributions and improvements.
For larger projects, you may need to adjust the Tailwind configuration to watch additional template file types.
The starter is designed to be lightweight and can be easily customized for specific needs.
While primarily focused on 11ty and Tailwind, the concepts can be applied to other static site generators with some modifications.