asteriskdothmg
asteriskdothmg

Reputation: 86

Angular Component Based CSS

In Angular 4/5, is there a way that component based will be generated to a file instead of style tag.

@Component({
    templateUrl: 'login.component.html',
    styleUrls: ['../../assets/css/auth.scss'],
    encapsulation: ViewEncapsulation.None,
    providers: [AuthenticationService]
})

Only files under angular-cli.json styles were generated to a file.

"prefix": "app",
 "styles": [               
   "../src/assets/css/bootstrap.min.scss",
   "../src/assets/fonts/fontface.min.scss",                
   "../node_modules/@angular/material/prebuilt-themes/indigo-pink.css", 
   "app/chronos/assets/css/main.scss"
 ]

Here is what I am using:

Upvotes: 1

Views: 85

Answers (1)

Tamadrumma
Tamadrumma

Reputation: 11

You'll need to remove the stylesheet from the styleUrls property in your component and either add it to the styles property in angular-cli.json or add it to a top-level css file referenced from your index html file.

Upvotes: 1

Related Questions