Chapter 9: Sharing Code and Resources

In this chapter, it's time to bring the projects together. It is possible to share code between Blazor Server and Blazor WebAssembly. This is also how we would create reusable components and share them in the community or just in the workplace.

Using this approach, it is no longer important to choose Server or WebAssembly. This way, you can use Blazor Server while you are porting your existing site and when you are done, just move the shared library to a new hosting model.

We will also add static content such as CSS.

In this chapter, we will cover the following topics:

  • Cleaning up the project
  • Setting up the API
  • Moving the components
  • Adding static files
  • CSS isolation

Technical requirements

Make sure you ...

Get Web Development with Blazor now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.