Angular – How to include custom files with angular-cli build

angularangular-cli

RE: Angular2 2.0.0, angular-cli v1.0.0-beta.11-webpack.8

How do I tell angular-cli to include a file from "src/assets" in the root of "dist" when it builds?

We deploy to a Windows host and need to include a "web.config" file to tell IIS to route everything to index. We were doing this pre RC4, but with all of the updating it fell through the cracks (I don't remember how we did it).

I've been scouring the GitHub repo docs and haven't found anything of use in regards to this topic. Maybe I'm in the wrong place?

In the ToC, there is a bullet point "Adding extra files to the build", but it appears that section doesn't exist.

Best Answer

The "assets" property of angular-cli.json can be configured to include custom files in angular-cli webpack build. So, configure "assets" property value as an array. For example:

"assets": ["assets", "config.json",".htaccess"],

above configuration will copy config.jon and .htaccess into dist folder during the angular-cli webpack build. above setting worked in angular-cli version 1.0.0-beta.18