All Projects → kkgthb → 11ty-tailwind-jit

kkgthb / 11ty-tailwind-jit

Licence: other
Try editing some Tailwind in this repo while running in dev. It's SO FAST!

Programming Languages

javascript
184084 projects - #8 most used programming language
Liquid
124 projects

Projects that are alternatives of or similar to 11ty-tailwind-jit

frontenso-11ty-starter
Production-ready 11ty+Gulp+Webpack Starter that features Nunjucks, SASS, TailwindCSS (with JIT complier), and ESNext.
Stars: ✭ 24 (+41.18%)
Mutual labels:  jamstack, eleventy, 11ty
11up
A utility to create an 11ty site scaffold from one of a number of site templates. Mostly just Phil Hawksworth's regular starting points
Stars: ✭ 25 (+47.06%)
Mutual labels:  jamstack, eleventy, 11ty
fernfolio-11ty-template
The super simple portfolio template built with Eleventy and Netlify CMS
Stars: ✭ 64 (+276.47%)
Mutual labels:  jamstack, eleventy, 11ty
smix-eleventy-starter
A standards-respecting starter kit for Eleventy. Go Indie.
Stars: ✭ 108 (+535.29%)
Mutual labels:  jamstack, eleventy, 11ty
Eleventy High Performance Blog
A high performance blog template for the 11ty static site generator.
Stars: ✭ 3,492 (+20441.18%)
Mutual labels:  eleventy, 11ty
11tyby
Simple 11ty setup using TypeScript, SASS, Preact with partial hydration, and other useful things. Aims to provide the DX of Gatsby, but using 11ty!
Stars: ✭ 38 (+123.53%)
Mutual labels:  eleventy, 11ty
agilitycms-eleventy-starter-2020
A sample Eleventy starter that uses Agility CMS and aims to be a foundation for building fully static sites using 11ty and Agility CMS.
Stars: ✭ 18 (+5.88%)
Mutual labels:  jamstack, 11ty
woliveiras.github.io
My personal Blog
Stars: ✭ 25 (+47.06%)
Mutual labels:  jamstack, eleventy
eleventy-plugin-svelte
Eleventy plugin to support svelte templates
Stars: ✭ 40 (+135.29%)
Mutual labels:  eleventy, 11ty
eleventy-plugin-blog-tools
A collection of shortcodes, filters and tags that make blogging on 11ty more fun
Stars: ✭ 41 (+141.18%)
Mutual labels:  jamstack, 11ty
virtual-lolly
JAMstack demo site - prerendered with serverless API fallbacks
Stars: ✭ 110 (+547.06%)
Mutual labels:  jamstack, eleventy
eleventy solo starter njk
Further development suspended as of 2021-09-11. Please refer instead to https://www.11ty.dev/docs/starter/ for a wide selection of other Eleventy starter sets.
Stars: ✭ 22 (+29.41%)
Mutual labels:  eleventy, 11ty
htmlrecipes
A collection of quick copy HTML snippets for a variety of common scenarios.
Stars: ✭ 113 (+564.71%)
Mutual labels:  eleventy, 11ty
trailing-slash-guide
Understand and fix your static website trailing slash issues!
Stars: ✭ 255 (+1400%)
Mutual labels:  jamstack, eleventy
objectfit-focalpoint
Generate the object-position value to capture an image's focal point given a custom aspect-ratio.
Stars: ✭ 14 (-17.65%)
Mutual labels:  eleventy, 11ty
alexcarpenter-11ty
📝 Source files for my personal website built with Eleventy and hosted with Netlify.
Stars: ✭ 89 (+423.53%)
Mutual labels:  eleventy, 11ty
11ta-template
Deeply customizable, full-featured, ready to publish blog template built with 11ty, TailwindCSS, & Alpine.js
Stars: ✭ 98 (+476.47%)
Mutual labels:  jamstack, 11ty
11ty-sass-skeleton
Featuring absolutely nothing beyond a base HTML5 template and the essential setup to watch and compile your Sass alongside 11ty.
Stars: ✭ 174 (+923.53%)
Mutual labels:  eleventy, 11ty
smol-11ty-starter
Extremely minimal Eleventy starter to kickstart a simple multi-page site / a nearly opinionless foundation to continue building on.
Stars: ✭ 61 (+258.82%)
Mutual labels:  eleventy, 11ty
eleventy-plugin-prismic
Eleventy plugin and shortcodes to fetch and present Prismic content
Stars: ✭ 39 (+129.41%)
Mutual labels:  eleventy, 11ty

11ty - Tailwind "JIT" (Just In Time) CSS starter

The nifty thing about this Tailwind "JIT" starter for Eleventy is that you can see your changes take effect while you type into your templates, making it much easier to ask yourself, "How would it look if I changed mx-2 to mx-4?" when you're totally new to Tailwind and can't imagine it all from memory.

(You might have to play with /src/tailwind/tailwind.config.js if you're using, say, .11ty.js templates, so as to add them to the "watched" files.)

Many thanks to Darrik Moberg for the code on which this is modeled, and for all the debugging help adapting it to Tailwind JIT. I can't really take credit for this code -- just for stripping it down to a starter.

Thanks also to Mike Allanson for additional troubleshooting.

Known issues

Issue 1

Every once in a while, particularly as you start overwhelming Tailwind JIT with things like plugins and a larger template codebase, your changes might stop taking effect on the screen served by your running development server (you can see that things stop getting freshly written out to /dist/tailwindoutlive.css).

Solution 1

Restart your server once or twice. Now that Tailwind JIT builds quickly, rather than taking up to a minute like legacy Tailwind, you should be fine, other than it being a bit of a nuisance.

Issue 2

Tailwind seems to be sensitive to the value of the NODE_ENV environment variable, and this might not work w/ null values for that variable.

Solution 2

Make sure to adjust your build process to set it to production or development appropriately. You might do this through package.json if you're running simple commands.

Personally, I enjoy the environment-variable injection of built-site-hosting CLI tools like the Netlify CLI (which makes use of server-stored environment variable values, values set in netlify.toml, and, while running netlify dev, values set in .env files on your local machine), and keeping my package.json files clean.

I prefer the CLI tool approach because I typically code on a Windows machine but deploy to a Linux machine, which I find messy to code package.json around.

Live example

See this site live on Netlify

Build your own theme

You don't really need this "starter" to play with Tailwind. Just grab these files:

  1. /src/_data/tailwindcss.js
  2. the 2 files under /src/tailwind
    • (you should probably change the config to be a little more specific to your use of Tailwind)
  3. /src/postcss.config.js
  4. /utils/postcss.js

Your package.json will need a few dependencies:

{
    "@11ty/eleventy": "latest",
    "@tailwindcss/jit": "latest",
    "autoprefixer": "latest",
    "cross-env": "latest",
    "postcss": "latest",
    "postcss-cli": "latest",
    "tailwindcss": "latest"
}

And your .eleventy.js config could use a little help:

  // Sometimes handy for making sure your browser refreshes the CSS
  eleventyConfig.addShortcode("version", function () {
    return String(Date.now());
  });
  // Apparently this, on top of the PostCSS pruning options watching 11ty, helps 11ty watch Tailwind or something.
  eleventyConfig.addWatchTarget("./dist/tailwindoutlive.css");

Sprinkle them into any starter and ... ta-daaaa! It's a Tailwind starter.

Postscript

I sort-of did a Gatsby Tailwind JIT starter as well. Maybe one day I'll make a proper starter, rather than just bolting Tailwind JIT onto an old project, but I'm pretty mediocre at React, so maybe I won't.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].