Angular-cli: how do i get cli to copy random files to dist folder?

Created on 18 Sep 2016  路  9Comments  路  Source: angular/angular-cli

versions: angular-cli: 1.0.0-beta.14
node: 5.10.1

i needed to copy random files into the dist folder. it's not clean from the the documentations how to accomplish the same.

appreciate any help.

thanks in advance.

Most helpful comment

I am on 1.0.0-beta.14

Look in your angular-cli.json file for "assets" under "apps". The default value is "assets", which represents the name of the folder you need to create under your "src" folder. This folder, and its contents, will be copied to the "dist" folder during "ng build".

Of course you can change the name of this folder to whatever you want, as long as it matches what is in your angular-cli.json file. IE:
"assets": "myAssets"

src -> myAssets

All 9 comments

This capability was lost a few weeks ago - you and I and others are eagerly hoping for its return. I feel like there is an inevitable opening for such a mechanism to be misused, so it would be great to do without it - but without it, too many projects will be driven away from CLI. Therefore, I hope it returns.)

(For some use cases you can work around it by copying extra files to "dist" after running ng build; for other that won't work, because that doesn't make the files available at top level URLs during development with ng serve.)

Im writing a chrome extension in Angular 2 with the cli and chrome extensions need a manifest.json file in the root of the app, so I would really like this feature back as manually copying files sucks! :(

I am on 1.0.0-beta.14

Look in your angular-cli.json file for "assets" under "apps". The default value is "assets", which represents the name of the folder you need to create under your "src" folder. This folder, and its contents, will be copied to the "dist" folder during "ng build".

Of course you can change the name of this folder to whatever you want, as long as it matches what is in your angular-cli.json file. IE:
"assets": "myAssets"

src -> myAssets

This works

How do you get it to copy a file that exists in the root /src/manifest.json

I'm trying to build a PWA and need to move the manifest.json to the root. Currently I am moving this with a shell copy script but would be nice to incorporate this into the ng build process.
@Lightw3ight - did you find a solution?

On the next release, this should be available: https://github.com/angular/angular-cli/pull/2570

write manifest.son in assets, file anuglar-cli.json

"apps": [ { "root": "src", "outDir": "dist", "assets": [ "assets", "favicon.ico", "manifest.json" ],

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings