79118384

Date: 2024-10-23 14:38:36
Score: 0.5
Natty:
Report link

What about bundling the styles to the separated css file and then linking it in the head?

enter image description here

<head>
   ...
   <link rel="stylesheet" href="styles.css" />
</head>

Then we just have to link all the styles to the main file.

// styles.scss
@import './app/app.component';

// app.component.scss
@import './app/component1.component';
@import './app/component2.component';
@import './app/component3.component';

... and so on to the deepest level.

Also it seems that we have to remove all the styleUrls.

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
})

Other way style tag still will be added to the DOM head, which will break unsafe-inline CSP policy.

For me it seems the only way now to get rid of 'unsafe-inline' from Angular apps now.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): What
  • Low reputation (0.5):
Posted by: Emil