8

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

3 Answers 3

12

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" 
      ],
Sign up to request clarification or add additional context in comments.

Comments

4

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.

Comments

2

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

1 Comment

explain a bit of what is relevant to question in your answer for a better understanding of viewers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.