Building a site with nuejs
not quite static, but very small
- tags
- nuejs
Contents
nuejs is a modern way to build content sites that uses modern browser features to make everything much simplier and cleaner than something like astro or vite. It's still early, but its fun to play around with.
It's got strong feelings about its global design system, standardizing the page layout, how to use css, and a nifty bit of markdown extension which makes it easier to focus on the content of the site.
I like the simplicity, lets see what we can do.
Install bun
|
|
Create the project in a temp directory:
|
|
site.yaml
|
|
index.md
|
|
Start the server
|
|
and you can see that it prints out some nice semantic html
|
|
<html dir="ltr" lang="en-US"> <head> <meta charset="utf-8"> <title> What happened when monkeys got thumbs? </title> <meta content="2024-08-20T18:04:04.543Z" name="date.updated"> <meta content="width=device-width,initial-scale=1" name="viewport"> <meta content=" " name="nue:components"> <link href="/@global/layout.css" rel="stylesheet"> <link href="/@global/typography.css" rel="stylesheet"> <script src="/@nue/hotreload.js" type="module"></script> </head> <body> <header> <nav aria-label="navigation"> <a href="/"> Monkey Thumb</a><a href="/about">About</a> </nav> </header> <main> <article> <section> <h1> What happened when monkeys got thumbs? </h1> <p> Practical AI tools to solve real world tasks. </p> </section> <section> <h2 id="check-it-out"> <a href="#check-it-out" title="Check it out"></a>Check it out </h2> <p> This is an example of all my awesome stuff. </p> </section> </article> </main> <footer> <nav aria-label="copyright"> <a href="/"> © Monkey Thumb</a> </nav> </footer> </body> </html>
Which looks like:
Adding global styles
Adding in styles is as easy as putting css into the @global
directory
(which was specified in site.yaml
)
|
|
Here is the main layout section.
|
|
And here we can add some typography.
|
|
|
|
Adding in a library
Lets add motion to our main page. First we need to tell it to import that library:
|
|
And then lets put in some motion stuff in @library/motion.css
|
|
|
|
|
|
Which gives us
Just a start
There's a lot more to the framework, but the stripped down css and having nav layout built in is very compelling.
Previously
Next