1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How can I pull Angular application files from CDN?

Discussão em 'Angular' iniciado por Anton Bobylev, Junho 26, 2025.

  1. After Angular builder has done its job, index.html already has JS and CSS files auto linked. Like this:

    <!doctype html>
    <html lang="en" data-beasties-container>
    <head><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <title>{TITLE}</title>
    <meta charset="utf-8">
    <link rel="shortcut icon" href="{CDN_URL}images/theme/favicon.ico">
    <link rel="icon" href="{CDN_URL}images/theme/favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/build/browser/styles.css">
    <body class="mat-app-background">
    <app-root></app-root>
    <script src="/build/browser/polyfills.js" type="module"></script>
    <script src="/build/browser/main.js" type="module"></script>
    </body>
    </html>


    My "raw" index.html:

    <!doctype html>
    <html lang="en">
    <head>
    <title>{TITLE}</title>
    <meta charset="utf-8">
    <link rel="shortcut icon" href="{CDN_URL}images/theme/favicon.ico">
    <link rel="icon" href="{CDN_URL}images/theme/favicon.ico">
    <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    {JSSCRIPTTAGS}
    </head>
    <body class="mat-app-background">
    <app-root></app-root>
    {JSCODE}
    </body>
    </html>


    As you see it writes sources for scripts and styles from my local machine. So I would like to remove this autolink and do this myself in backend (this isn't a problem, I have tools to do this).

    How to not autowire this files after the build? Is there some config or something?

    My CDN link updates every weekend, so I can't to hardcode it. I have to write those links in my backend.

    Continue reading...

Compartilhe esta Página