-1

Is there a way to download or package additional files say assets likes images or json files into the final build at compile time?

I am trying to find a way I can have the files packed to the server if they are managed from a separate CMS system.

Or is it best to just try to find a way to integrate CMS into github so when content changes it deploys automatically?

danewfie
  • 13
  • 3

1 Answers1

2

You can do that by adding files in the assets property in the angular.json. When you create a build, angular will automatically add these files in the build folder. For example:

 "assets": [
        "assets",
        "favicon.ico",
        "config.json"
      ],

Or

"assets": ["addfileshere"]
Apoorva Chikara
  • 8,277
  • 3
  • 20
  • 35
  • Thanks, is there a away to add files which are from a webserver or some other external location? I can only find ways to add assets manually. – danewfie Sep 28 '21 at 14:46
  • For that you can use gulp, it does provide copy. Create a folder add files to that from external source. Add gulp copy command to the build command. So, when you create a build this extra command will help you copy things from external directory. You should use append command. If you need more help, I can add to the answer. – Apoorva Chikara Sep 28 '21 at 15:56
  • 1
    Brilliant! How I've missed this up till now I just don't know. Thank you! Gulp allows me to package up the content I need based on my dynamic requirements. – danewfie Sep 28 '21 at 19:08