tobsai
tobsai

Reputation: 103

.Net Core 2 SPA/Angular Template - Render Global CSS

I am very new to Webpack and the .NET Core 2 Angular SPA Template. I'm trying to create a global stylesheet for the entire site. I could reference that style in the Layout view to render it in the main view, but then I lose the benefits of the pre-render engine and bundling with WebPack (as well as minification).

The Webpack documentation says that in order to include static CSS that you need to add a require(../filepath) to your module, but I don't see a way to do this in the boot.browser.ts.

I'm still just getting started with .NET core so my site is basically just the OOB .Net Core 2 template with Angular. I'm keeping my global styles sheet in ClientApp/Styles/Global.css at the moment. Thanks for your time.

Upvotes: 8

Views: 1254

Answers (1)

user4851087
user4851087

Reputation:

As in visual studio 2019 Angular template with ASP.Net Core 2.2 you don't have to manage webpack file like old version. I'm assume that you are using Angular 5 with webpack template.

Create ASP.Net Core app like this

enter image description here

Then you will see style.css in your angular app. That is where you put your global style

enter code here

Hope it will help you. Best regards.

Upvotes: 1

Related Questions