使用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/