-
Notifications
You must be signed in to change notification settings - Fork 9
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
Tailwind helper: support for compiling CSS #20
Comments
There is now twind cli, https://github.com/tw-in-js/twind-cli#twindcli |
Using https://github.com/srid/tailwind-nix
generates a |
Could use https://github.com/tweag/inline-js to evaluate nodeJS code. |
@billksun My understanding is that TailwindCSS's official CLI does not have a mode where you can ask it "here's a list of HTML files; can you dump the compiled and merged CSS for it?". In windicss, twind/cli - you can do this in a straightforward manner (see srid/emanote#58 (comment)), without having to touch JavaScript (like the need to create & manage a (Ideally I'd get rid of windicss/twind too; but that will need us to develop a pure Haskell compiler for tailwind, which will also come in handy for live-server integration in Ema so that CDN need not be used anymore) |
Tailwind 2.2.0 got released, but some of its new features work only in JIT, which means it won't work with Ema's live server as that uses CDN. That sucks, and it is all the more reason to do a complete port of Tailwind to pure Haskell and use that from Ema. https://github.com/tailwindlabs/tailwindcss/releases/tag/v2.2.0 |
Works more reliably now; though not turned-on by default yet.
For the record, emanote solved this by using windicss to compile the CSS from generated HTML files, https://github.com/srid/emanote/blob/master/default/_emanote-bin/compile-css |
Now that Tailwind 3.0 is released, it just might be better to use the official compiler (thus requiring nodes), and use https://tailwindcss.com/blog/tailwindcss-v3#play-cdn for live server (assuming it works like twind does). EDIT: Play CDN is actually noticeably slower. |
A demo of using Tailwind 3.0 for Ema sites here: EmaApps/banyan#5 (works in both live server and static site modes) Basically, run the Tailwind watcher to generate |
Progress towards srid/ema#20 Uses nixpkgs fork until NixOS/nixpkgs#153677 is merged.
There is a very simple solution here. All we need to do is run the tailwind CLI once at the start of Ema live server, because the classes are used in Html DSL in Haskell anyway: https://github.com/srid/banyan/blob/e9119e2c055c00a720a17cab10c0a7811cd85765/src/Main.hs#L29-L40 For other use cases (like Emanote) that use plain .html files (or specify classes in other ways) - we will have to run tailwind in JIT mode using the For This does mean that EDIT: Actually we do have to run tailwind in JIT mode, otherwise the one-off run can take as long as 1 second (perceptible delay). So we gotta figure process runner to run tailwind in parallel and integrate the generated CSS to our routes. |
https://github.com/srid/ema-template now runs Tailwind 3.x, both in live server and static site generation. This issue is done to the level of alpha quality, and is usable today. But I'll keep it open for any potential improvements (especially for Heist templating in Emanote) and improving docs. |
srid/emanote#503 demonstrates using Tailwind CDN to get 3.x in live server. |
Instead of using the twind shim, which requires JS and thus
as it demonstrably does with prismJS herenot true)... we should try a windicss like approach in "compiling" the classes from generated HTML into the final minified CSS. The tailwind helper can provide both options.
(Might as well explore writing a type-safe Haskell wrapper for Tailwind, as a stretch goal)
The text was updated successfully, but these errors were encountered: