Angular 2+ Component Library - packaging assets

Viewed 298

I have created a Angular 4 based component library. I have also been able to successfully use this library in another Angular project. However, one of the components makes use of a SVG, which is located in the /assets folder of the library. This is being referred in the component as follows,

<img src="/assets/svg/icon_recommendation_close.svg"/>

Obviously, when this component is used the main app, the image is looked for in the /assets folder of the main app, which is not available resulting in HTTP 404.

Now my questions are,

  1. What are the options available to me to package images and other similar assets?
  2. How can these be made available to the main app?
  3. Is it possible to configure the main app to look into the /nodes_module folder of the library if I am able to package the SVG into it?
  4. The other option I was thinking was to inline the SVG into the HTML itself using a gulp utility. Is it ok to do this?

Thanks Sushil

0 Answers
Related