Avatar image home | reference architectures | about about me |
message send message

Taking nuejs for a spin; Early thoughts

• Blog posts are my own thoughts and opinions

Hero image for Taking nuejs for a spin; Early thoughts

Nue.js ... markdown with mega powes

First impressions ...

Disclaimer, I'm only reviewing version 0.3.1, meaning actual behaviour might be different by the time you read this article.

(✓ Nue 0.3.1 • Bun 1.0.22)

(i'm updating this list in realtime while I'm working and hit any issues. My feedback is going to be random, all over the show as I find I need something and then dive into the documentation to find out how to do it the Nue way. I'll clean this up more in a few days with a final review.)

(I've just completed the draft of my early impressions, I'm posting this to linkedin as-is, and will refactor this next, convert to sematic <sections/> and CSS, that will make the list a lot easier to read.)


Excellent documentation

improvements?

  • I would like to either have a search, or have a way to toggle to navigate the docs in one single long page, so that i can simply use browser Cmd+F to find something.

  • When I first started using Nue, I found myself coming back and hunting for stuff I had read and having to click through many pages each time to find what I'm looking for.

  • Maybe better description for beginners of how to get tabs working? (I know it's simply a case of applying appropriate stying to selected and non selected elements, but beginners will not see that.)

more serious problems;

  • No documentation on how to add Google Analytics to the blog you just created in the tutorial.

Docs updated 1 day after reporting!
  • Adding GA script to the <head> Just crashes with unexpected token error. I assume the only way to do it on version 0.3.1, is to manually create the entire page layout yourself, which totally defeats the purpose of using a markdown engine. I assume that this will be sorted in later releases.

  • I tried making a component for the GA code, but that resulted in different errors.

  • I will raise this as a issue on github, but including the negative feedback here, because it's so far the only negative I could find, and I'm concerned my review is not balanced. 😆

  • I know this will probably be resolved quickly, but, here for completeness.

  • For now, the workaround is to drop in your own root as described here; bit fiddly, I know, but I assume only temporary.

  • Update: I tried to follow the above workaround notes to define your own root and got a host of other errors, and I had to eventually give up. Running out of time. I can probably write a cloudflare plugin to do this for me, but I can see this being a deal breaker for a lot of people trying it out to use for their blog, so hopefully this is natively supported soon.

fixed in version 0.3.2
  • Error messages dont provide any help in current version : below is the error message I recieved when I tried to follow the instructions above using my own <html> root.

  • Images in bullet lists don't appear to be supported, just gets' rendered as encoded markdown instead of being transformed : [! /img/p/build-settings.png]

Semantic design is contageous


Encourages shipping fast and iterating


Hosting using Cloudflare pages with a fake 'makefile'

Hosting on cloudflare Pages couldnt have been simpler. See the screenshot above, that has the entire folder structure of my blog;

Setting up for the first time

  1. Git init, and follow nue getting started guide to create your starter blog in a folder called X, in my case called blog.

  2. Create a fake makefile called deploy in the root of your project. Copy the idea from my deploy.sh, to create a deploy.sh for yourself.

  3. Add your git project to github.

  4. Do not exclude the .dist folder. (edit your .gitignore if necessary)

  5. The only important steps in the deploy.sh file is for the script to do a production build BEFORE committing (git push) to your repo. This will PUSH your latest build.

  6. In your cloudflare dashboard, go to workers and pages

    • click create an application -> pick -> pages -> connect to git -> select your blog repo -> begin setup

    • on the next screen, select -> (main branch) -> (framework preset = None) -> Build command (leave blank) -> Build output directory (blog.dist/prod)

    • click save and deploy

  7. Your build settings should now look like this

  8. Create apage in your blog

  9. When you're done, make sure you're in a terminal at the root, and run ./deploy my new foo foo page

  10. Wait about 5 to 10 seconds, and it will be live. I kid you not, it's that fast.

Yes, I know that's a no-no in normal development processes; but for now, it works really well since everything is just so trim and tiny. (If i was using nue to build an actual SPA application the I would not advise doing it this way, but for a blog, imo it's just too simply not to do it)


Consideration for production use


Some questions I still have

  • Not entirely sure that I like multiple css files; Only because I think I've seen some caching issues with css files, and I'd prefer to have a single css file I can change the name of and do a poor man's cache busting. There's probably a bun bunding setting I've not seen. I'm sure I'll get there.

  • It's just something I think you need to be aware of, if you're using it for the first time.

  • I'd like to see a pit of successs here, where this is guaranteed to work, and you only change the bundling of css files if you know what you're doing.

  • Need to see how Nue fits with htmx.org


What I have not test driven yet


My favourite features

Detailed notes with demo screenshots coming. (tabs is described below)

Dev server is sometimes slow</strong>


Collections sorting appears not to work


Nuemark tables don't support normal content

fixed in commit d2215c7

Fast accurate replies from Nue devs


This entire blog website is built using nue, not just this particular blog-post, so my comments are based on my experience while building this site porting old content, and learning nuejs from scratch on the way.

Alternative platforms I looked at;

Astro, Hugo, nextjs, (todo, complete my list of alternatives I looked at using.) I also created an ADR (Architectural De)

Additional observations (after the review)

syntax highlighing coming soon!
Date Notes
21/01/24 I'd drop a lot more hacks here, but I will wait for the ability to render nicely formatted fenced code blocks. then I can go mental with all sorts of ideas. For example; it's trivial to fix almost anything you find that you don't like, I created a `blog-list` to replace default table as a quick workaround to the comma creating new `TD`'s I mentioned further up. I'll share my very un-sexy but totally good-enough blog-table here when fenced code blocks are available. The table just above these two paragraphs is delivered using my hacked custom component. Some things will need to be fixed in the core lib though, like the post.url not ending with .html, and kicking off http 308.
custom controls are sane (easy to reason about and have a very low learning curve) Code above is the custom control to render the table just above.

Disclaimer: These views and opinions are those of the author and do not constitute professional advice. Neither Alan Hemmings nor Goblinfactory Ltd (if mentioned) shall be liable for any reliance on this content.