-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support tailwindlabs/tailwindcss-jit #422
Comments
We'll definitely add it as some point, JIT looks great and I can see many other benefits of using it in Maizzle. However, it's still experimental so we'll need to wait for a (more) stable version, or until it gets into Tailwind core. Even then, it'll very likely be an option that your need to turn on in Maizzle, mainly because of the fact that you lose the ability to rapidly prototype in the browser (since you no longer have all classes generated). |
JIT has just been added to Tailwind 2.1. I have used JIT on a react project and confirm the engine is fast enough to still prototype almost instantly. |
Yes we'll definitely add support for it, just need a bit more time to make sure we don't break anything and that it works as expected. |
Played a bit with this today and there's good news and bad news. Good news is you can simply enable it yourself if using Tailwind CSS v2.1.0 or above: module.exports = {
mode: 'jit',
purge: [
'src/**/*.*',
],
} Bad news is that core plugins are not disabled anymore. This is a showstopper for HTML email, because you'll get color classes with opacity variables like this: .text-red-400 {
--tw-text-opacity: 1;
color: rgba(248, 113, 113, var(--tw-text-opacity));
} CSS variables have poor support in email, so this means your CSS colors will not work in some of the most important email clients, like Gmail, Outlook, or Yahoo! I've opened tailwindlabs/tailwindcss#4071, let's wait and see what the team says. |
A workaround for using JIT while developing locally, but falling back to AOT when building for production, would be to enable JIT based on module.exports = {
mode: process.env.NODE_ENV === 'local' ? 'jit' : 'aot',
purge: [
'src/**/*.*',
],
} However this won't work right away, because we're not setting |
Released v3.3.1 so you can now use the workaround explained above. |
Using Tailwind's own purging has now been implemented in #432, and we'll soon publish a new release. Remember, to use JIT you will (currently) need to:
Example: module.exports = {
mode: process.env.NODE_ENV === 'local' ? 'jit' : 'aot', // all `maizzle build` commands that specify an environment name will use 'aot'
purge: [
'src/**/*.*',
],
// ...
} |
Another way of using JIT only when developing locally is to specify a custom Tailwind config object for your production builds: // tailwind.config.js
module.exports = {
mode: 'jit',
purge: [
'src/**/*.*',
],
// ...
} // config.production.js
const omit = require('lodash/omit')
// Remove 'mode' and 'purge' keys from Tailwind config in production
const twconfig = omit(require('./tailwind.config'), ['mode', 'purge'])
module.exports = {
build: {
tailwind: {
config: twconfig,
},
// ...
} This way you rely on your Maizzle config files instead of the Using this myself in a project with >50 emails where for some reason having framework/src/generators/tailwindcss.js Lines 22 to 29 in 87e73bb
Note: as mentioned in my previous comment, we currently can't use object syntax for |
Is it planned to generate minimal css with the new tailwindlabs/tailwindcss-jit instead of purging from the traditional huge set of Tailwind classes?
In my use case the files generated by Maizzle become templates consumed by another templating system (.eex / Elixir). As those .eex templates should be up to date during development on each edit, I do a
maizzle build production
of all templates on each save. For this use case it would be relevant to improve the build times with tailwindlabs/tailwindcss-jit.I would be happy to contribute with a PR if you have a hint where to start.
The text was updated successfully, but these errors were encountered: