Using Angular-CLI build to copy a file / directory

后端 未结 2 957
太阳男子
太阳男子 2021-02-02 11:26

Is there a way to make angular-cli\'s ng buil --prod command to also copy a file/directory to the dist folder?

My project includes a \"server\" folder, and

相关标签:
2条回答
  • 2021-02-02 11:35

    On your angular-cli.json on assets object add the folders you want to include like:

    Note : For Angular 9, this should be placed on angular.json file

    "assets": [
        "assets",
        "favicon.ico",
        "META-INF",
        "WEB-INF"
      ]
    
    0 讨论(0)
  • 2021-02-02 11:59

    For those wanting to copy files outside the src folder:

    In example below I am copying all files from myfolder to the root dist folder.

    In the angular-cli.json file (3rd line):

    "assets": [
       { "glob": "**/*", "input": "./assets/", "output": "./assets/" },
       { "glob": "favicon.ico", "input": "./", "output": "./" },
       { "glob": "**/*", "input": "../myfolder", "output": "./" }
    ],
    

    Angular-cli.json Documentation here

    0 讨论(0)
提交回复
热议问题