Posts

Showing posts from March, 2021

Fun with Dad Jokes

Image
I was browsing Javascript projects that are available online so I can convert them to  Blazor.  It is fun to try to do everything they did in JavaScript in Blazor.  I came across this application.   This project was created just for pure enjoyment.   There are a couple of Blazor changes that were needed, but overall it is fairly straightforward and a ton of fun to implement. The implementation was to make an API call to get a Dad joke from a Dad Joke service, yes they have those.  Then get a random image to display, then display the image on each request. The project was inspired by Brad at Traversy Media .  He has a ton of great videos and courses on web development.  He does a good job of explaining the details as well.  You should check him out. Applications Objective The application is an entertaining project that just felt good to build.  It will randomly display a dad joke with a random image. It is that simple. Blazor Parts 1. Create Project     I wanted to deploy this project w

Blazor UI Component Library

Image
 I was reviewing some sample code the other day and I noticed that the index.html file had a lot of linked CSS files.  This got me thinking: "Question: If UI components are in separate assemblies and use CSS isolation, would you still need to include the CSS file?" The short answer is NO.  if you use CSS isolation, you don't need to include the CSS files. We can go from this: <link href="ComponentLibCSS.styles.css" rel="stylesheet" /> <link href="/_content/Assembly1/styles.css" rel="stylesheet" /> <link href="/_content/Assembly2/styles.css" rel="stylesheet" /> <link href="/_content/Assembly3/styles.css" rel="stylesheet" /> <link href="/_content/Assembly4/styles.css" rel="stylesheet" /> To just this: <link href="ComponentLibCSS.styles.css" rel="stylesheet" /> A key point to remember for this you must be on .Net 5 or gre