Overview
Webite: https://rfui.deno.dev/
This is a component library that is currently intended to be used on projects using Deno’s web framework Fresh and is built according to the following philosophical principles.
- Opinionated
- Scale down
- Limit your choices
- Prioritize documentation
- Pit of success (eg. by providing tips and references to best practices, and by prefixing with underscores)
- Pretty
- Use the platform
- Pareto solutions > high customizability
Notes
Early stage
It is currently in a very early stage. See the project page.
Atomic Design
It follows the Atomic Design Methodlogy by breaking components into “atoms”, “molecules” and “organisms”.
Syntax Highlighting
If users want CodeBlock
to have syntax highlighting, they’ll have to use
Prism. Here’s what that involves:
- Generate a
prism.js
andprism.css
file here. Make sure you include whatever languages and plugins you need. Ie. if you want to let users copy the code to their clipboard, you’ll need to include the “Copy to Clipboard Button” plugin. - If you want stuff in code blocks to wrap, change
white-space:pre
inprism.css
towhite-space:pre-wrap
. - Load them with something like
<script src="/prism.js"></script>
and<link rel="stylesheet" type="text/css" href="/prism.css" />
. - After your JavaScript has loaded you (might?) need to call
Prism.highlightAll();
. One way to do this is to include<script>Prism.highlightAll();</script>
right before</body>
.
Islands in docs
Most docs pages use ComponentDocsPage
from
/islands/demo/component-docs-page.tsx
. However, when docs pages need to be
interactive – ie. because the component they’re documenting is an island –
using ComponentDocsPage
won’t work because you
can’t pass functions into an island
(see also this GitHub issue).
I also tried refactoring ComponentDocsPage
to accept the current props as
children
instead, but that didn’t work for reasons I don’t understand.
So then, I was forced to be pretty WET (instead of DRY) in the docs pages for components that are islands.
Releasing
Versioning
To create a new version of this library:
- Use https://github.com/adamzerner/rfui/releases/new
- Update CHANGELOG.md
- Follow semantic versioning
Generating the Tailwind CSS file
I’ve tried to find a good terminal command or script to run but haven’t found anything good, and it doesn’t seem worth spending more time looking.
So here’s the process.
- Go to
tailwind.config.ts
and removeroutes
since that directory is just for the documentation, not for code that will be used by library users. - Run
deno task start
. - In Firefox, open the dev tools, click the “Style Editor” tab, and refer to
app.css
. That’s the file that users of the library will need.