Posts

Showing posts with the label CSS Isolation

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...