Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gruntjs grunt usemin don';不替换图像路径_Gruntjs_Grunt Usemin - Fatal编程技术网

Gruntjs grunt usemin don';不替换图像路径

Gruntjs grunt usemin don';不替换图像路径,gruntjs,grunt-usemin,Gruntjs,Grunt Usemin,我不知道是否有人问过这个问题,但我没有找到相关的线索。 我用grunt构建我的静态页面,在“/dist/index.html”下生成我的“index.html”后,我用usemin(和useminPrepare)在这个文件上运行,合并并缩小我的css和js文件,效果很好 但我的index.html中相关的图像不会被替换(并从源代码复制) 例如,我希望下面的代码 <img src="/src/assets/images/my-image.png" width="50" height="50"

我不知道是否有人问过这个问题,但我没有找到相关的线索。 我用grunt构建我的静态页面,在“/dist/index.html”下生成我的“index.html”后,我用usemin(和useminPrepare)在这个文件上运行,合并并缩小我的css和js文件,效果很好

但我的index.html中相关的图像不会被替换(并从源代码复制)

例如,我希望下面的代码

<img src="/src/assets/images/my-image.png" width="50" height="50" alt="My alt title" />

将unter/dist/index.html替换为

<img src="/images/my-image.png" width="50" height="50" alt="My alt title" />

并且图像也从/src/assets/images/my-image.png复制到/dist/images/my-image.png

我怎样才能做到这一点


提前感谢。

使用节点包“grunt string replace”(请参阅)解决了此问题。

没有人能解决此问题吗?或者有其他方法来实现这一点?