I have developed a star rating library, inside the library there are 3 images that are used to display the star rating.
For the moment I have instructed to copy the images to the assets folder of the angular project, so that I can point, in the component, to the assets folder to view the images.
Is there a way to set the path of the images to point to the library folder itself in node_modules? So you have to avoid manually copying files into assets?
Or is it possible to copy the files into assets automatically? maybe during the installation of the library?
Thanks
Yes you can use angular.json for this. Here are the docs: https://angular.io/guide/workspace-config#asset-config
Pointing from withing the app to node_modules is not workable since this path is not available in the build app. In this way the assets will be available in the distributable package.
Example from one of my projects:
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/package-namespace/package/lib/assets",
"output": "./assets/"
}
],