Code Buckets

Buckets of code

Angular

Copying static files into build directory with Angular

This is probably obvious for Angular aficionados and aficionadistas but I found how to copy static files into the output directory of an angular application non-obvious.

To do it go to angular-cli.json in your project root and add the static file to the assets collection thus

"apps": [
{
"assets": [
"assets",
"favicon.ico",
"mystaticfile.txt"
],

And it places it nicely into the output folder which is dist by default. I found this useful when using a web.config file to set up some URL rewriting rules in an IIS hosting scenario i.e..

"apps": [
{
"assets": [
"assets",
"favicon.ico",
"web.config"
],
.. rest of app settings
}];

Just though I would break it out of that post and flag up how to do it when I had a spare 10 mins between cleaning the bathroom and taking the daughter to swimming lessons (too much information – sorry).

LEAVE A RESPONSE

Your email address will not be published. Required fields are marked *