Angular组件库-模板中的图像引用 [英] Angular component library - image references in templates

查看:29
本文介绍了Angular组件库-模板中的图像引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个npm软件包,其中包含许多角度组件.他们在模板中引用图像.如果我将图像复制到应用程序的 images 目录中,则引用可以解析,但这感觉很愚蠢.

I have an npm package that has a number of angular components. In their templates, they reference images. If I copy the images to my application's images directory, the references resolve, but this feels stupid.

是否有办法让webpack处理图像,以便当App B包含来自App A的组件时,图像可以在构建版本中工作并且不涉及手动复制步骤?

Is there a way to have webpack handle image writing so that when App B includes components from App A, the images work in the build and there's no manual copy step involved?

推荐答案

如果此npm软件包中未正确要求图像,则webpack将无法对其进行处理.您可以尝试使用 copy-webpack-plugin 之类的东西,或者编写自己的复制脚本来避免手动操作复制

If images are not properly required in this npm package then webpack won't be able to process them. You may try something like copy-webpack-plugin or write own copy script to avoid manual copying

这篇关于Angular组件库-模板中的图像引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆