包含聚合物纸元素的最简单 HTML 页面

Simplest possible HTML page with Polymer Paper Elements

如何使用 Polymer Paper Elements 创建最简单的 html 页面?

我想要一个 html 文件,它从其他地方 (CDN) 加载所有需要的库。示例:

<!DOCTYPE html>
<html>
  <head>
    <title>Polymer Test</title>
  </head>
  <body>
    <paper-button>hello world paper button</paper-button>
  </body>
</html>

这显然是行不通的,因为 <paper-button> 不为浏览器所知。那么我必须包含什么才能使其在所有当前浏览器上运行?

是否可以不自己下载任何库并将它们放在我的 html 文件旁边的网络服务器上?

您可以使用 Polygit 类似 CDN 的 Polymer 工具

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Polymer Simple</title>

    <base href="http://polygit.org/polymer+:master/components/">

    <script src="webcomponentsjs/webcomponents-lite.min.js"></script>
    <link href="polymer/polymer.html" rel="import">
    <link rel="import" href="paper-button/paper-button.html">
  </head>
  <body>
    <paper-button raised> Hello World!</paper-button>
  </body>
</html>

这里是 codepen 和 polygit,你可以 fork kit