Convert Bootstrap Template to a Blazor Application (Part 1)
There are a lot of free Bootstrap them web sites available, just google: free bootstrap themes. It got me thinking what would it take to convert a simple web site to Blazor?
I found a nice single page web site called Freelancer . It is a personal web site that allows the author to display their portfolio of projects. It contains information about the author and a contact me form.
I decided to do a little more than just convert it over. I want to make it more dynamic and generic so I can use it on multiple web sites. This is the part one of a set of 7 blog posts that cover what it took to get it all done.
Download
I downloaded the template and opened it in Visual Code. I reviewed the code and then I ran it. It is a cure little site.
Start the Blazor Application
- Create a Server side Blazor application
- Run the Blazor application and make sure everything is building and running correctly.
- Remove un-needed template artifacts
- Data Folder
- Counter Page
- FetchData page
- Remove the Weather Forecast Service from start up
- Copy over the static content
- CSS
- Images
- Javascript
- SCSS
- Vendor Folder
- Add the CSS files to _Html.cshtml
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
- Add the javasciprt file to _Html.cshtml
- For the main CSS file, you can either replace the site.css file with the freelancer.css file, or you can do what I need. I open site.css, deleted all the lines and pasted in the lines from freelancer.css.
- Open index.razor and paste the html from the freelancer body html.
- Change the title to “Blazor Static Bootstrap”
- Add your personal Avator
At this point we should be able to run the application and at least see the same web site with the CSS applied.
We can see it is running from local host and the top title has changed to “Blazor Static Bootstrap”.
What is not working
It looks nice, but the template is JavaScript based for handling events. We did not move over any of the JavaScript files. We need to test a little and see what is not working between the HTML based one and our Blazor application.
Items not functioning
- Top menu is not working
- Top menu is not responsive
- Clicking on the Portfolio is not displaying the modal
- Go to Top button on a small screen is not working.
Comments
Post a Comment