Angular 2+ Component Library - Packaging Assets

I created a component library based on Angular 4. I was also able to successfully use this library in another Angular project. However, one of the components uses SVG, which is in the /assets

library folder . This applies to the component as follows:

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

      

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

Now my questions are:

  • What are the options available to me for packaging images and other similar assets?
  • How can they be accessed by the main application?
  • Is it possible to configure the main application to view /nodes_module

    the library folder if I can package the SVG into it?
  • Another option I was thinking about is embedding SVG in HTML itself using a utility gulp

    . Can this be done?

Thanks Sushil

+3


source to share





All Articles