简体   繁体   English

如何在我的React项目中包含外部模块的图像?

[英]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.

相关问题 如何将外部 javascript 库包含到我的 react js 项目中? - How can I include an external javascript library to my react js project? 如何将 .gitignore 文件包含在我的 npm 模块中? - How do I include a .gitignore file as part of my npm module? es2015模块语法,如何导入项目目录之外的文件 - es2015 module syntax, how do I import a file that is outside of my project's directory 如何在我的 angular 2 项目中正确包含“require”? - How do I correctly include "require" in my angular 2 project? 模拟json文件如何将其包含在项目中? - Mock json file how do I include it in my project? 我如何在我的 React 类中的接口中包含接口? - How do I include Interfaces within Interfaces In my React Class? 如何在Android Studio的React本机项目中包含外部库? - How to include an external library in a React native project in Android Studio? 如何在 PHP 中包含外部文件? - How do I include external files in PHP? 我必须在外部脚本中包含$(document).ready(function()多少次 - how many times do I have to include the $(document) .ready (function() in my external script 如何使用 webpack 将全局 JS 文件包含到我的 React 项目中? - How can I include a global JS file to my React project using webpack?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM