Angular Material 2 theme not working in production

I have imported a CSS theme in my style.css in my project as shown below, just as it was stated on the Angular Material website.

@import '~@angular/material/prebuilt-themes/indigo-pink.css';

      

When I have this in dev mode styling works, however when I build for production styling doesn't work.

Any ideas?

+3


source to share


2 answers


Add this line to the styles array in angular-cli.json:



"../node_modules/@angular/material/prebuilt-themes/indigo-pink.css"

      

+3


source


you can add   <link href="https://unpkg.com/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet">

in <head>

the index.html section



OR copy the pre-built themes from the node-modules / @ angular / stuff, eg. to the / assets folder, then @import "./assets/prebuilt-themes/indigo-pink.css"; in your css / scss file

0


source







All Articles