108 points · by langcss · 2y ago · 128 comments
This is my personal project that is an IDE and AI assistant for creating tailwind components and pages. You can chat to create designs, then make small edits yourself, and continue chatting to refine them. I am always working to improve the UX.
I have a time limited demo page here: https://langcss.com/demo
Please let me know what you think! Feedback is welcome.
Tech wise, this just uses NextJS (Hosted on Docker) and Azure Open AI.
And the pricing is outrageous, this is more expensive than subscribing to ChatGPT, with not much benefit other than a visual preview that can be accomplished with copy/paste.
> This is a lot slower to use than simply copying components from a pre-built UI library and making your own changes
Correct. This is something I am aware of, and next steps would be to make it easier to search and add free (open source) components to build up the UI. In retrospect I probably should have started with that, and then AI'd it.
> You wouldn’t use Tailwind and any of its surrounding products unless you knew the syntax and what it does.
This is true, but often as a Tailwind user I am stumpted on "how to create the thing in my mind". A good example is gradient text, but where the bottom of a letter like g is not cropped.
> And the pricing is outrageous, this is more expensive than subscribing to ChatGPT, with not much benefit other than a visual preview that can be accomplished with copy/paste.
It might be. The $30/m price for an ChatGPT wrapper has to have very good fit for someone, and I am probably not there yet.
Here's an idea: produce designs that use the commercial Tailwind components. Your designs will look great. Have a link for the user to buy the components if they don't already own them. Work out an affiliate deal with Tailwind Labs. You can get rid of the time limits and the pricing.
If you start generating money for them they may buy your app.
probably AI solves that for you, by generating another 50 classes and applying even more to your n levels of nested divs.
Who cares if a div has 15 classes? When writing React, I spend pretty minimal effort creating, debugging, or modifying TW classes, especially when using `classNames` so I can break them into logical chunks. The hardest part is... oh, I get it.
The hardest part is when other people do a shit job of organizing their classes and I have to dig through them. But an LLM isn't going to solve that problem, only an actual, intelligent algorithm to standardize class arrangement would help, like prettier for tailwind classes.
It's a write-only DSL for CSS, easy to write but hard to then read and edit afterwards, which is a problem that you're blaming on a skill issue while it's a problem inherent to Tailwind's philosophy itself. Just use CSS Modules at that point.
That said, if you enjoy Tailwind, good for you!
if you can write tw you can write css. if you can write css theres no valid reason to write tw.
Even if bottleneck are images, I still care about bloat on mobile internet.
Do what you want but I honestly don't understand why anyone who already knows how to write CSS would use Tailwind
I'm not in the market for this (not convinced by Tailwind or by the AI assisted coding, yet) but people who are may need more than a few minutes to properly judge it.
Not the best demo, to be honest.
In a 8 hours day of work, I must write code at most for 2 or 3 hours, and any AI would certainly not help me unless it can understand the meaning and intention of weird C++ code. We're relatively safe for the moment.
Creating a full game is a bit beyond the scope of what we can do here,
especially since games typically require a lot of JavaScript and game
logic, not just UI design. However, I can help you design a cool game UI
using TailwindCSS! For example, we can create a simple game landing page
that includes a hero section, game features, and a footer. Let's start
with a basic layout: working on code, 822 characters...
Understandable, but it didn't let me confirm, it just started building a landing page even though I asked for a game.I never got to see the end result, my demo seconds ran out before it finished making it and the pricing overlay appeared.
However, I realized you can just Inspect Element and delete the pricing overlay and use the product as much as you want haha. So the second time around I said "design a basic landing page" and after several minutes it rendered what looks like a very stripped down default page with an image at the top and text sections with a copyright of 2023.
Feedback: IMO it should not be a 5 minute timer, but just limit them to ~3 generations. And should move the validation to the backend, so people can't just delete the overlay and use the service for free (I could Block Element in AdBlocker and never see it again). Beyond that I would just iterate on quality.
Thanks for sharing, it could be very good if it was faster and had a little higher quality outputs.
Tailwind will be a no brainer for it since it's all one line and would still be readable/tweakable to the user.
Candidly, producing components from scratch like this, I just haven't seen anyone do a great job.
Now, rewriting, tweaking, and plugging in content? Really good at modifying if you can get it to be fast.
The costs of this post were $35 for OpenAI tokens. No one has reported any slowness or downtime.
I am just hosting on the $5/m DO (Digital Ocean) app plaform. CPU spiked at 8% at the highest. Pages are served from the CDN that DO takes care of and the API backend (which doesn't use a CDN) is mostly node forwarding on requests to Azure.
I didn't get analytics (I don't care, comments are more useful) in so can't say how many visitors. But CDN reports say 12000 requests per minute was the peak. Which probably includes all images and so on. So maybe 600 page loads per minute as a guess.
I said in the post "Docker". That is probably true under the hood! But I meant to say "Digitial Ocean".
* Create new account (API)
* Deposit a small amount of money
* Click "Assistants"
* Create a new one, based on GPT-3.5 or GPT-4-turbo if you want to spend a few cents instead of millicents
* Enter "You are an expert Tailwind CSS developer and you fulfill the requests presented to you to the best of your knowledge" as the system prompt
* (add "The user will gift you a tip if your answer is good" for expert level answers)
* Navigate to "Playground" and select your newly created assistant
* Done
Alternatively, download llama3 or any popular and current open weight LLM, run it with llama.cpp or llamafile and enjoy ChatGPT-3.5 and above levels of Tailwind Expertise
I'm not saying the answers will be good, just that they will at least be at the same level.
this is one of them
We're working on a similar--but general-purpose--LLM-based software agent[1]. General purpose tasks are very hard, and we too are finding that tackling narrow use cases one at a time works much better!
I have an open PR to start moving in this direction [2]
Also, the tokenization for raw HTML code produces too many tokens which drives up the cost. Optimizing the tokenization process for HTML could potentially reduce costs and enhance performance.
You were able to deliver, ChatGPT was not.
For example, give it a Tailwind login form/page and have it create a dark version. Have it generate an alternative layout, etc.
I haven't made it obvious but you can start off with your own code, and then get it to iterate on that.
E.g.
1. Get some code from https://v1.tailwindcss.com/components/forms
2. Paste into HTML window
3. Enter into chat "Can you make the sign in button here red?" and click Send.
It will then make the button Red for the form you pasted in, keeping the rest as-is.
I love the idea.
For a website that produces designs, your landing page looks a bit simple.
I asked it to generate a table. Now I'm not sure if the progress bar on top shows the code generation progress or if I'm running out of demo time.
It took a while but now I have a table, thats pretty cool :)
https://chat.openai.com/g/g-T9FuS9MCA-tailwindcss-expert
It actually works quite well.
Need to try feeding it the docs sometime.
Are you willing to share the prompt directly?
For anyone still wondering why wouldn't I just write css? Because my codebase is littered with orphaned dead css. You can try to use strict naming conventions to connect it to the component it was meant for, but in practice you end with more css, dead css, and you have to read two source code files: component and css.
First prompt I tried gave me a tailwind 2 CDN link in the example.
Nice idea. Like it.
You are an expert Tailwind CSS developer that I will ask for help. You may need to google the latest docs from Tailwind here: link.
And I get all the help I need.
Is that part of the prompt necessary anymore? I feel that was a version 3 thing.
My prompts have been getting less verbose & I've been finding little value in introductory phrases, correct grammar or spelling.
I don’t do anything locally lately, but I believe you’d either have to pad your prompt with something like what I showed you above or mess with the system prompt.
The stuff is there in the ollama docs, someone else can probably give you more details.
Better yet, just ask gpt about all this lol.
Edit: I might be misusing the word Agent here.
I can help you with that for only $9.99 a month!
If someone builds this, please do not ask for yet another subscription. At least make it self-hostable and charge for the hosted one.
Until something comes out which performs auto generation of boilerplate/project code (against technical specs) I’m going to stick with test generation, as that is the only consistent output from LLMs that makes sense in my workflow.
(You need to sign in, then you have unlimited generations.)
Source code: https://github.com/gitwitorg/gitwit-server
It's still in beta and pretty buggy, but happy for feedback as well!
Congrats on the launch. I enjoyed that it gave me progress updates as it worked.
Any tailwind class can have named colors ("green"), semantic colors "danger" and then you can chose the number of the gradient of that color.
There are thousands of them. Only the ones you use get compiled into the css file.
> Combined with minification and network compression, this usually leads to CSS files that are less than 10kB, even for large projects. For example, Netflix uses Tailwind for Netflix Top 10 and the entire website delivers only 6.5kB of CSS over the network. - https://tailwindcss.com/docs/optimizing-for-production
What does increase is the html or react payload. But at least it's only sending what you use.
Most websites are sending all of the styling for all of the pages and states, even though the user never sees it. It takes work to optimize that away, and things go wrong often.
There are many clever macros like `space-x-4` that compile to very tricky effects. You couldn't write that in the style attribute at all. https://tailwindcss.com/docs/space#add-horizontal-space-betw...