Uxmaan Ali
Uxmaan Ali

Reputation: 349

How to include js file without knowing proper name in Asp.Net Core

<script src="~/angular/runtime*"></script>
<script src="~/angular/polyfills*"></script>
<script src="~/angular/vendor*"></script>
<script src="~/angular/main*"></script>

enter image description here

I want to add these scripts in my Layout page

Upvotes: 7

Views: 376

Answers (1)

Marco
Marco

Reputation: 23937

As far as I can tell, the hashes in your js file names are caused by the --prod flag in the angular-cli.

You basically have to options here:

  • remove the --prod flag
  • add --output-hashing none flag

That means you would end up with a build command similar to this:

ng build --prod --output-hashing none

Please note, that the hashes serve a specific purpose: Cache-Busting. Everytime you generate a new build, these hashes change and if you inject the script(s) automatically into a html file using the angular-cli, this has the benefit of not needing to check if you have to clear your cache and if the changes have been picked up by your browser or if they have been served from disk.

Documentation: https://angular.io/cli/build

Upvotes: 6

Related Questions