Home >Web Front-end >CSS Tutorial >Cassi: An AI-Powered CSS Style Guide Generator
Cassi is an AI-powered tool designed to generate markdown-based documentation from existing CSS files. It leverages AI models to generate meaningful information about each CSS rule. This process makes it much easier to document complex stylesheets.
Working on projects with a large amount of CSS rules, possibly scattered across multiple files, can be challenging. Existing tools often focus on component libraries, require comments to be added to the rules, or are outdated, making it difficult to document raw CSS styles effectively.
I built Cassi to address this issue by analyzing existing CSS files and generating markdown-based documentation for each rule.
Here's what makes Cassi a powerful tool:
As of the time of writing this, Cassi is not much more than a Node JS script and a prompt template. I do have plans to add some additional functionality, more on that later. For now, let's look at how it works.
CSS Parsing
AI-Powered Markdown Generation
Create Markdown Documentation
As you can see, the process is relatively straightforward, and demonstrates what you can achieve with the correct prompt when working with even local models.
Here's an example of the markdown output Cassi generates using qwen2.5-coder on Ollama:
--- title: "Styling for .btn-primary" tags: ["CSS", "Styles", "Selectors"] permalink: "/styles/btn-primary/" shortDescription: "Primary button styling for highlighting important actions." selectors: - ".btn-primary" --- ## Overview The `.btn-primary` rule defines the primary styling for buttons that should stand out, typically used for important calls to action like "Submit" or "Save." ## Usage Here's how to use this rule in your HTML: ``` html <button> <h2> GitHub Repository </h2> <p>You can find the Cassi repository on GitHub itlackey/cassi if you would like to see the code, try it yourself, or even help improve the tool.</p> <h2> What's Next for Cassi? </h2> <p>Cassi was built to solve a problem I am currently facing. Now that I can easily generate the documentation that my team needs, we can start focusing on adding a few more features to improve our workflow even more. Here are some features I am considering adding:</p>
CSS documentation doesn't have to be a manual, time-consuming process. Cassi can quickly generate rich, markdown-based documentation that is easy to use, integrate, and customize.
What do you think? Would Cassi be useful in your projects? Let me know in the comments below!
The above is the detailed content of Cassi: An AI-Powered CSS Style Guide Generator. For more information, please follow other related articles on the PHP Chinese website!