|
| 1 | +# @tailwindcss/jit |
| 2 | + |
| 3 | +An experimental library that generates CSS with the same API you already know from Tailwind CSS, but on-demand as you author your template files instead of generating an extremely large stylesheet once when you start your build system. |
| 4 | + |
| 5 | +This has the following advantages: |
| 6 | + |
| 7 | +- No long initial build time (Tailwind can take 3–8s to compile in isolation, and upwards of 30–45s in webpack projects) |
| 8 | +- No need to purge unused styles, since styles are generated as they are needed |
| 9 | +- Your CSS is identical in development and production, so there's no chance of accidentally purging a style you needed to keep |
| 10 | +- No need to explicitly enable variants, everything works out of the box since file-size isn't a limiting factor |
| 11 | +- No dev tools performance issues that stem from parsing large stylesheets |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +#### Current limitations: |
| 16 | + |
| 17 | +These are all things we're actively working on, but aren't ready yet in this current pre-alpha release. |
| 18 | + |
| 19 | +- Custom CSS is not processed, can't use `@apply`, `@layer`, `@screen`, etc. |
| 20 | +- User plugins are not supported |
| 21 | +- Can't use complex media queries |
| 22 | +- Container is very naive, doesn't support complex options Tailwind normally supports |
| 23 | +- No prefix support |
| 24 | +- No !important support |
| 25 | +- No custom separator support |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +#### **To Dos:** |
| 30 | + |
| 31 | +- [x] Get our data structure rendering to CSS, perhaps rework data structure if needed |
| 32 | +- [x] Solve for a candidate that has multiple rules with different order numbers |
| 33 | +- [x] Make tabular nums work with media queries |
| 34 | +- [x] Avoid redundant generation of rules used by multiple candidates |
| 35 | +- [x] Avoid redundant generation of rules used by multiple candidates in variants |
| 36 | +- [x] Generate a hover variant |
| 37 | +- [x] Make a hover variant stack with a screen variant |
| 38 | +- [x] Generate focus variant |
| 39 | +- [x] Make a hover variant stack with a focus variant |
| 40 | +- [x] Get a resolved config object we can use to read values from |
| 41 | +- [x] Move variants and plugins to their own modules |
| 42 | +- [x] Generate all screens based on config object |
| 43 | +- [x] Make a dynamic plugin read from the config |
| 44 | +- [x] Put utilities in right place (@tailwind utilities) |
| 45 | +- [x] Add Preflight styles |
| 46 | +- [x] ~~Figure out a more user-friendly API for specifying variant precedence~~ Just works baby. |
| 47 | +- [x] Cache PostCSS nodes instead of our data structure? Lots of wasted time re-parsing styles we've already parsed |
| 48 | +- [x] Cache all generated styles each build, only inserting generated styles for changed files and re-sorting/CSSifying then |
| 49 | +- [x] Make sure variants are applied to all classes in a selector, not just first |
| 50 | +- [x] ~~Enforce variants order (no hover:sm:underline)? Or just make it work~~ This just works, builds are faster if you use a consistent order though because it's a cache hit |
| 51 | +- [x] Add tests for the love of god |
| 52 | +- [x] Resolve config at run-time, re-resolve when config changes |
| 53 | +- [x] Read template files from purge config, not from files config |
| 54 | +- [x] Add support for `theme` function |
| 55 | +- [x] Make animation utilities work |
| 56 | +- [x] Make components/container generally work |
| 57 | +--- Feb 25 |
| 58 | +- [x] Make the group-* features work |
| 59 | +- [x] Add dark mode support |
| 60 | +- [x] Put components, static utilities, and utilities into a single map for faster lookups |
| 61 | +- [x] Sort responsive components before responsive utilities (need to reserve a bit for layer?) |
| 62 | +--- Feb 26 |
| 63 | +- [x] Look for more specific matches, only run those matches (ring-offset shouldn't also run ring matches) |
| 64 | +- [x] Refactor pass in modifier as string instead of parts array |
| 65 | +- [x] Refactor plugins to use more specific keys |
| 66 | +- [x] Support negative values, we don't see these utilities at all because of the `-` prefix, we also split on `-` so the prefix doesn't make it to the plugin |
| 67 | +- [x] Avoid re-resolving config if build was triggered by template change |
| 68 | +- [x] Use single addUtilities API for both static and dynamic plugins |
| 69 | +- [x] Test with Vue components and <style> blocks (tons of watchers?) |
| 70 | +- [x] Figure out how to support multiple PostCSS builds (this is extremely common, every Vue style block, every CSS module, etc. Need to be careful about global state) |
| 71 | +- [x] Support multiple config formats but probably less than before |
| 72 | +- [x] Figure out how to close Chokidar watchers whenever we generate a new context, I think we are leaking them |
| 73 | +- [x] Flatten color palette once for performance |
| 74 | +--- Feb 27 |
| 75 | +- [x] Simplify all of the concurrency code, model it more correctly |
| 76 | +- [x] Avoid memory leak in contentMatchCache (every time a file is saved with different content this cache grows) |
| 77 | +- [x] Figure out when to clear caches |
| 78 | +- [x] Test with Laravel mix |
| 79 | + |
| 80 | + |
| 81 | +- [ ] Add support for plugin API |
| 82 | +- [ ] Make existing official plugins work |
| 83 | +- [ ] Rebuild when config dependencies change |
| 84 | +- [ ] Support container configuration options |
| 85 | +- [ ] Support complex screens configuration |
| 86 | +- [ ] Make prefixes work |
| 87 | +- [ ] Make important work |
| 88 | +- [ ] Make separator work |
| 89 | +- [ ] Make @apply work |
| 90 | +- [ ] Add support for custom CSS that supports variants (anything in @layer?) |
| 91 | + |
| 92 | +- [ ] Support square brackets for arbitrary values |
| 93 | +- [ ] Support purge safelist (just add entries to candidate list, regexes will be harder though) |
| 94 | +- [ ] Incorporate 'transformThemeValue' properly (mostly important for `theme` function which already works, but also need it to support array syntax for things like box shadow in someone's config) |
| 95 | +- [ ] Support "dynamic" components |
| 96 | + |
| 97 | +- [ ] Refactor plugins to an abstraction that handles negative values, transformThemeValue, etc. |
| 98 | +- [ ] Factor the code in a responsible way |
| 99 | +- [ ] Put plugins in deliberate order |
| 100 | + |
| 101 | +=== |
| 102 | + |
| 103 | +- [ ] Include vendor prefixes for modern browsers by default so autoprefixer is only needed in production? |
| 104 | +- [ ] Cache Preflight styles? They only change when the config changes (default font family, border color, etc.) |
| 105 | +- [ ] Collapse media queries |
| 106 | +- [ ] Cache entire PostCSS tree and re-use if no candidate cache misses |
| 107 | +- [ ] Move code to a feature flag in Tailwind, hopefully without introducing additional performance costs |
0 commit comments