Home > Enterprise >  Angular: styles.css vs. styles.xxxx.css
Angular: styles.css vs. styles.xxxx.css

Time:11-11

While developing looks the style link in DOM "normal".

On production a hex number is added and looks like this example:

<link rel="stylesheet" href="styles.2a837f84c87615489567.css">

Which parameter must be set (in "angular.json"?) do avoid adding the number? What else must be done?

CodePudding user response:

If you want to modify your generated bundles that should not have numbers, then you can easily configure that by modifying angular.json options outputHashing to none

angular.json

  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        ....
      },
      "configurations": {
        "production": {
          ...,
          outputHashing: none,
         ...
      },
    },
 },

OR

pass --output-hashing=none parameter to command.

ng build --prod --output-hashing=none.
  • Related