Polymer CLI:构建组件页面

Polymer CLI: build component page

使用 polymer init 你可以创建一个元素项目,使用 polymer serve 你可以提供组件页面(显示文档和演示)。

为了服务它,Polymer CLI 进行了一些路径重新映射,因为导入标签与项目结构不匹配。来自文档:

When you run polymer serve, all elements in bower_components are remapped to appear to be in sibling directories relative to my-el. The current element is served from the made-up path of /components/bower name, where bower name is the name field from your element project's bower.json file.

构建 组件页面以便它可以由另一个 Web 服务器提供服务的适当方法应该是什么?

我应该移动文件以使它们与参考文献匹配,还是有更好的方法?

有一个工具可以将组件页面部署到 github 个页面。
来自 docs:

In the commands below, replace with your GitHub username, and with your GitHub repository name.

# git clone the Polymer tools repository somewhere outside of your 
# element project
git clone git://github.com/Polymer/tools.git

# Create a temporary directory for publishing your element and cd into it
mkdir temp && cd temp

# Run the gp.sh script. This will allow you to push a demo-friendly
# version of your page and its dependencies to a GitHub pages branch
# of your repository (gh-pages). Below, we pass in a GitHub username
# and the repo name for our element
../tools/bin/gp.sh <username> <test-element>

# Finally, clean-up your temporary directory as you no longer require it
cd ..
rm -rf temp

This will create a new gh-pages branch (or clone and clear the current one) then push a shareable version of your element to it. To see your newly-published docs, point a browser at:

http://<username>.github.io/<test-element>/