Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Tailwind JIT #43

Closed
regisphilibert opened this issue Dec 10, 2021 · 6 comments
Closed

Support Tailwind JIT #43

regisphilibert opened this issue Dec 10, 2021 · 6 comments

Comments

@regisphilibert
Copy link
Member

Pending this is addressed upstream, we might take a 馃憖 at https://www.brycewray.com/posts/2021/11/making-tailwind-jit-work-hugo/ and see...

@brycewray
Copy link

Pending this is addressed upstream, we might take a 馃憖 at https://www.brycewray.com/posts/2021/11/making-tailwind-jit-work-hugo/ and see...

I surely know you'll do far better than I did, sir. ;-) The method I described therein is obviously and uncomfortably hacky.

@regisphilibert
Copy link
Member Author

Well... Hugo Pipe PostCSS ability has not been updated for a long time, it's lacking a lot fo stuff compared to js.Build so I'm threading lightly. But we'll see :) I'll probably get back to you with questions :)

@regisphilibert
Copy link
Member Author

regisphilibert commented Dec 15, 2021

I think we'll need two very different approaches. 1. Development and 2. Build

Development

Tailwind has a CDN we can get (resourses.GetRemote).

The doc mentions how you can add script tag with your tailwind config (we can get the file and print its content) along with a style tag
With your own tailwind powered styles (again get our file and print its content)

That should do it for development. This way we don't have Hugo and Tailwind watch files concurrently. Enough problems in the past.

build

We'll need to run two consecutive script

  1. npx tailwind to build the tailwind css with tailwind config, template browsing etc...
  2. Hugo. To take our own styles and concatenate then with the previously built tailwind css.

Note that this is not necessarily ideal for Huge as this means users will need to run those scripts, adding them to their package.json scripts... we're getting away from the Hugo only approach.

But this would allow us to use Tailwind 3 internally and forgo of PostCSS altogether.

Until Hugo supports Tailwind JIT. (No eta in sight)

@brycewray
Copy link

Am presuming you already saw this (hence the "no eta in sight" mention):

https://discourse.gohugo.io/t/tailwind-v3-0-and-hugo/35994/9

@regisphilibert
Copy link
Member Author

I did not! Thanks for pointing this out! This seems much closer than I initially thought. We'll wait for the upstream fix then, what I've got up there is quircky, time consuming, and wouldn't fit with what we're trying to achieve here: Simplify things.

@regisphilibert regisphilibert added the wontfix This will not be worked on label Dec 15, 2021
@regisphilibert regisphilibert removed the wontfix This will not be worked on label Feb 11, 2022
regisphilibert added a commit that referenced this issue Feb 11, 2022
This will essentially use the current best workaround to run Hugo Pipe + JIT

Addresses #43
@regisphilibert
Copy link
Member Author

We've added it as an experimental feature pending the official upstream support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants