硫化 - 从哪里输入polymer.js?

时间:2016-02-15 01:18:24

标签: polymer polymer-1.0 vulcanize

我有一个imports.html页面,我正在硫化。

奇怪的是....通常在我的index.html <link rel="import" href="bower_components/polymer/polymer.html"> ....我不在imports.html。但是当我硫化imports.html时,它会以某种方式被包含在内,我必须从我的<link rel="import" href="bower_components/polymer/polymer.html">中移除index.html。否则,我会得到

Uncaught NotSupportedError: Failed to execute 'registerElement' on 'Document': Registration failed for type 'dom-module'. A type with that name is already registered.

当{硫化polymer.html时,imports.html来自何处?因为它不在imports.html

!-- custom style sheets-->
<link rel="stylesheet" href="css/splash.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/fade-title-animation.css">
<link rel="stylesheet" href="css/paper-ripple.css">
<link rel="stylesheet" href="css/slider-animation.css">
<link rel="stylesheet" href="bower_components/components-font-awesome/css/font
-awesome.min.css">
<!-- custom style sheets-->

<!-- bower components -->
<link rel="import" href="bower_components/paper-menu/paper-menu.html">
<link rel="import" href="bower_components/paper-item/paper-item.html">
<link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/paper-header-panel/paper-header-panel.html">
<link rel="import" href="bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="bower_components/iron-icon/iron-icon.html">
<link rel="import" href="bower_components/iron-icons/editor-icons.html">
<link rel="import" href="bower_components/paper-ripple/paper-ripple.html">
<link rel="import" href="bower_components/iron-icons/iron-icons.html">
<link rel="import" href="bower_components/iron-icons/image-icons.html">
<link rel="import" href="bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="bower_components/paper-material/paper-material.html">
<link rel="import" href="bower_components/paper-card/paper-card.html">
<link rel="import" href="bower_components/iron-media-query/iron-media-query.html">
<link rel="import" href="bower_components/paper-fab/paper-fab.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<!-- bower components -->

<!-- custom elements -->
<link rel="import" href="elements/portfolio/cards/card-behavior.html">
<link rel="import" href="elements/page-behavior.html">
<link rel="import" href="elements/page-styles.html">
<link rel="import" href="elements/footer-custom.html">
<link rel="import" href="elements/toolbar-menus/paper-menu-custom.html">
<link rel="import" href="elements/toolbar-menus/paper-tabs-custom.html">
<link rel="import" href="elements/portfolio/cards/portfolio-card-styles.html">
<link rel="import" href="elements/portfolio/portfolio-display.html">
<link rel="import" href="elements/portfolio/portfolio-page.html">
<link rel="import" href="elements/portfolio/cards/cloud-share-image-card.html">
<link rel="import" href="elements/portfolio/cards/cloud-monitor-card.html">
<link rel="import" href="elements/portfolio/cards/legacy-darin-card.html">
<link rel="import" href="elements/portfolio/cards/dad-site-card.html">
<link rel="import" href="elements/portfolio/cards/gulp-newy-card.html">
<link rel="import" href="elements/portfolio/cards/darin-hensley-card.html">
<link rel="import" href="elements/portfolio/cards/krunch-uploader-card.html">
<link rel="import" href="elements/resume/resume-page.html">
<link rel="import" href="elements/resume/resume-display.html">
<link rel="import" href="elements/contact-display.html">
<!-- custom elements -->

<!-- js -->
<script src="js/misc.js" ></script>
<script src="bower_components/page/page.js"></script>
<script src="js/router.js"></script>
<script src="js/resume.js"></script>
<script src="js/pdf.js"></script>
<script src="js/pdf.worker.js"></script>
<script src="js/initialize.js" defer></script>
<!-- js -->

1 个答案:

答案 0 :(得分:4)

您有一个导入polymer.html的元素 查看自定义元素并检查包含此导入的文件。(我认为所有聚合物元素都包含此导入) 以递归方式对导入进行硫化扫描。

真正的问题是您只硫化导入文件而不是所有索引。如果你只想硫化imports.html文件,你必须将所有导入放在这个文件中。

在常规情况下,什么是幸福和(在你硫化之前)

浏览器解析html文件。如果它有2个具有相同网址的导入,则导入一次。

在您的情况下,硫化导入文件。

现在它包含了polymer.html,然后当你在索引上导入这个文件时,浏览器不知道在硫化文件中你有bio.html文件。所以它再次导入..