taken from comment: https://github.com/nrwl/nx/pull/1907#issuecomment-551991878
More often than not, building apps would usually have an asset property. For example, building apps would usually have an asset property you can specify in the workspace.json or angular.json.
You can read more here: https://nx.dev/react/api/web/builders/build#assets
With libs, there usually isn't an asset property you can specify when building those.
Yes there is.
It's available via the angular app config.
// the key is within: projects.myapp.architect.options
"assets": [
"apps/app/src/favicon.ico",
"apps/app/src/robots.txt",
"apps/app/src/manifest.webmanifest",
{
"glob": "**/*",
"input": "libs/shared/ui-theme/assets",
"output": "./assets"
}
],
This will copy all files from the assets folder of ui-theme into assets
so libs/shared/ui-theme/assets/img/logo.png will become the same as apps/app/assets/img/logo.png
@leon
How about Style sheets, can we store style sheet as well in the shared folder then copy it to assets folder at the time of build.
@leon
How about Style sheets, can we store style sheet as well in the shared folder then copy it to assets folder at the time of build.
That can be done in similar way via <target>.options.styles https://nx.dev/react/api/web/builders/build#styles
demo: https://github.com/nrwl/nx-examples/blob/master/angular.json#L38-L41
More often than not, building apps would usually have an
assetproperty. For example, building apps would usually have anassetproperty you can specify in theworkspace.jsonorangular.json.
You can read more here: https://nx.dev/react/api/web/builders/build#assetsWith libs, there usually isn't an asset property you can specify when building those.
this answer is enough, thx @Cammisuli , Closing
@leon , your sample would copy robots.txt to ./dist/assets/robots.txt
But according to https://www.robotstxt.org , this file should be in project root.