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
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" 
      ],
                        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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With