[英]How do I include an external module's images in my react project?
I have an external module ( npm install external-module
) that has it's own images with the given path: myProject/node_modules/external-module/dist/img
. 我有一个外部模块(
npm install external-module
),它具有给定路径的自身映像: myProject/node_modules/external-module/dist/img
。 How do I include these images in my public assets? 如何在我的公共资产中包含这些图像?
One option would be to use gulp or grunt to copy the images over from the npm directory to your public assets directory. 一种选择是使用gulp或grunt将图像从npm目录复制到您的公共资产目录。 This copy operation can run as part of your daily build process or on special occasions like after updates to the node module.
此复制操作可以作为日常构建过程的一部分运行,也可以在某些特殊情况下运行,例如在更新节点模块之后。
how to copy whole folders: Looking for way to copy files in gulp and rename based on parent directory 如何复制整个文件夹: 寻找在gulp中复制文件并根据父目录重命名的方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.