ciekals11
ciekals11

Reputation: 2155

Preload css in angular 15

I'm crating application in angular with SSR

How do I apply <link rel="preload" href="/styles.css" as="style" /> to head section or Link header in order to preload/prefetch whole styles.css file?

Using plain styles.css is not enoug as production build generate file that contains random characters like styles.7541caaaab536370.css (different in every build)

Googling about preloading and prefetching in angular only results in preloading components/modules and I'm out of ideas

Upvotes: 3

Views: 1652

Answers (1)

pthor
pthor

Reputation: 623

You can include the styles.css file in the assets folder. This will prevent the angular build process from "fingerprinting" the file and the resulting build file will simply be named styles.css allowing you to reference it directly from your index.html.

Upvotes: 2

Related Questions