我需要让我的图像链接到工作后,我的应用程序。如何让polymer build将src目录中的镜像路径转换为build/bundled/src
我的文件结构开始看起来像这样:
my-app/
index.html
images/
my-image.png
src/
my-element.html我链接到my-element中的一个图像文件,如下所示:
my-app/src/my-element.html
<img src="../images/my-image.png">图像看起来很棒。
要构建我的应用程序,我运行以下命令:
polymer build要查看我刚刚构建的内容,我运行:
polymer serve build/bundled现在图像链接断开了。因此,我检查了build/bundled目录中的源代码,注意到<img src路径引用没有更改,也没有在build/bundled/子目录中创建任何新的images/子目录。相反,我看到了以下内容:
my-app/build/bundled/src/my-element.html
<img src="../images/my-image.png">为此,文件结构应该有一个新的images/子目录,如下所示:
my-app/
index.html
images/
my-image.png
src/
my-element.html
build/
bundled/
index.html
src/
my-element.html
images/
my-image.png但事实并非如此。看起来像这样:
my-app/
index.html
images/
my-image.png
src/
my-element.html
build/
bundled/
index.html
src/
my-element.html因此,<img src链接断开。
我如何在我的polymer build进程中修复这个问题?我是否需要在我的polymer.json、manifest.json、package.json、gulpfile.js或类似的文件中添加一些东西?
发布于 2017-01-25 16:15:50
您必须在polymer.json文件中添加includeDependencies数组:
{
"includeDependencies": [
"images/**/*"
]
}https://stackoverflow.com/questions/41845658
复制相似问题