.Net Core 2 SPA/Angular Template - Render Global CSS
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
Then you will see style.css in your angular app. That is where you put your global style
Hope it will help you. Best regards.
How to add font awesome to ASP.NET Core Angular 2 application in Visual Studio 2017 with SpaTemplates
Credit original post
This is for .NET Core 2, after you create a SPA Project using dotnet new angular:
Go to the root of the project and install the package: npm install font-awesome --save. You should now see it in package.json dependencies.
After that go to webpack.config.vendor.js and add font awesome to the array under non tree shakable modules:
const nonTreeShakableModules = [
'bootstrap',
'bootstrap/dist/css/bootstrap.css',
'es6-promise',
'es6-shim',
'event-source-polyfill',
'font-awesome/css/font-awesome.css',
'jquery',
];Now we need to tell the webpack that we added this new package. So if you haven't done so before install this in the root of project with npm install --save-dev npm-install-webpack-plugin.
Finally, run this command in the root of project: webpack --config webpack.config.vendor.js
angular-cli how to add global styles?
As of the beta.14 release of the CLI (which uses Angular 2.0 final), a global stylesheet can be linked inside angular-cli.json
under the "styles" key. This is a reference to a file relative to the src/
directory, which is style.css
by default.
Leveraging this method you could:
- Copy the global styles into
src/styles.css
- Use CSS imports to import external rules into
styles.css
- Add more global styles via the
apps[0].styles
property inangular-cli.json
See also Global Styles in angular-cli
's wiki.
How to implement angular-mdc-web in .NET Core Angular VS2017 Template
Couple options to resolve ripple opacity issue. Downgrade node-sass to 4.7.2, or upgrade angular-mdc/web to latest v0.34.1.
Issue was related to variables in the ripple mixins not getting interpolated properly.
Hope this helps.
Related Topics
Svg CSS3 Transition on Fill Not Working When There Is External Link
Wrapper Question When Containing Floating Divs
How Reliable Is Double-Slash Comment in CSS
Increase a Div Size on Click with CSS Alone
How to Set This Div to Be The Minimum Possible Width to Display Its Floating Contents
CSS Specificity - External Style Sheet Vs Internal Style Sheet Using Just Classes
Div: After - Add Content After Div
CSS for Styling HTML5 Date Input Calendar in Chrome
How to Make a Responsive (Row Fluid) Mixin for Bootstrap
Insert Ruby in HTML Class=" " Property
Vertically Stretch Background Image
Browser Not Recognizing Max-Device-Width
Using Rem Units for a Div in a Web Page
Iframe Z-Index for Drop Down Menu