polymer CLI : build component page

标签 polymer polymer-1.0 web-component polymer-cli

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

为了服务它,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>/

关于 polymer CLI : build component page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39623020/

相关文章:

polymer - 与 Polymer.Templatizer 的两种方式数据绑定(bind)

javascript - 获取iron-data-table来渲染演示数据

polymer-1.0 - 聚合物1.0 : How to stop dom-repeat loop from executing using a dom-if check inside the loop

javascript - 将 Angular 物体绑定(bind)到 Polymer 1.0

Polymer Shadow DOM 中的 JavaScript 插件初始化

javascript - 关于自定义 Web 组件和生命周期回调的说明

javascript - 通过 webdriver.io 版本 7 访问 ShadowElements

html - 与其他方法相比,为什么 Polymer Project(Web Components)还没有出名?

javascript - iron-list [first,last]VisibleIndex 绑定(bind)不起作用?

jquery - polymer 核心列表 - 只显示足够的元素来填充视口(viewport)