我的印象是,如果我硫化了我的index.html,它会提取并连接我的html导入。这是我索引中的一个片段:
<!doctype html>
<html unresolved>
<head>
<base href="/">
<script src="/assets/traceur-runtime.js"></script>
<script src="/bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="/bower_components/core-icon/core-icon.html">
<link rel="import" href="/bower_components/core-item/core-item.html">
<link rel="import" href="/bower_components/core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="/bower_components/core-toolbar/core-toolbar.html">
等等。我只包括我需要的聚合物钻头。我没有任何自定义的自定义元素(我只是从核心和纸张组件中组装UI)。
我的印象是--inline和其他标志的某种组合会导致一个非常长的index.html,它不再直接导入bower_component文件。我想,我可能错了,但那是我的目标。这不是什么大不了的事;我甚至不确定这里的正确答案是使我的index.html巨大,以避免20个额外的负载,特别是缓存和所有这些。但是,如果没有内联版本进行测试,就无法对此进行测试。
编辑: 我在我构建的dist目录的根目录中运行硫化:
dist/
index.html
bower_components/
并且它运行了,我已尝试使用--inline和--csp以及两者,它基本上只是将index.html吐回到vulcanized.html。如果我做--strip,它会删除空格,但就是这样。
答案 0 :(得分:0)
我从未尝试过硫化我的Index.html
,我总是有一个elements.html
文件,其中包含我的所有导入文件,最后我会在我的主文件中导入elements.html
。
每当我尝试硫化我的elements.html
文件时,它都可以按照预期的方式连接所有元素&#39;定义到一个文件中,以减少浏览器必须进行的http请求的数量。
问题可能在于您使用的是Volcan
的最新版本,并且--csp
功能已经被移动到独立的cli应用程序并且--strip
}也已移至html-minifier
应用。
您可能想要检查出来。
https://github.com/PolymerLabs/crisper
https://github.com/kangax/html-minifier
答案 1 :(得分:0)
啊哈,我想出来了 - 当我应该使用href="/bower_components/core-icon/core-icon.html"
时,我正在使用href="bower_components/core-icon/core-icon.html"
。
注意缺少前导斜杠。现在我只需要弄清楚如何连接它以便它可以正确找到bower_components。