Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include a plain HTML file and folder with Angular CLI Build?

Tags:

angular

Is there a way for me to include a static html file using ng build? I would like to place it in a sub folder every time I build

e.g. MySite.com/static/index.html

I know I can do that manually, but would prefer to not do that for every build

like image 445
Mathias Avatar asked Aug 18 '17 18:08

Mathias


3 Answers

Add the static folder in your project and with index.html in it. Then, just add an entry to the target folder under assets in your .angular-cli.json:

"assets": [
        "assets",
        "favicon.ico",
        "static" 
      ],
like image 53
Faisal Avatar answered Oct 24 '22 06:10

Faisal


According to the docs, you can do this in .angular-cli.json. Add an entry to the apps assets array, similar to the following:

{ "glob": "index.html", "output": "static" }

This assumes that index.html is in the src folder. You can also include an input property in the object if the source directory is different.

like image 21
Kirk Larkin Avatar answered Oct 24 '22 07:10

Kirk Larkin


I came across this via a search for the same issue. The Angular documentation and file structure has changed a bit since previous posts.

Now configure it in angular.json and it is documented here:

https://angular.io/guide/workspace-config#assets-configuration

like image 2
kh42874 Avatar answered Oct 24 '22 06:10

kh42874