问题描述
是否可以将我的另一个插件作为库导入到新的插件中?
Is it possible to import my other plunker as a library in a new plunker?
说,我已经在插件中构建了一些AngularJS指令.我可以在其他pl子中重复使用它们吗?
Say, I've built a few AngularJS directives in a plunker. Can I reuse them in my other plunkers?
推荐答案
您绝对可以从一个小插曲引用到另一个小插曲,但是这样做的技巧并不十分清楚.从历史上看,Plunker并不是故意将其公开给用户的.
You absolutely can refer from one plunk to another, but the mechanics to do so are not very well exposed. Historically, Plunker didn't expose this to users by design.
在将来的版本中,Plunks将作为semver版本的软件包发布到软件包管理器,这种事情将自动为您连接.
In future versions, Plunks will be publishable as semver versioned packages to the package manager and this sort of thing will automatically be wired up for you.
要使用您今天在Plunker中建议的设置类型,您可以:
To use the type of setup you propose in Plunker today, you can:
- 将新指令创建为自己的Plunk,并确保将其保存.不管是公共的还是私人的都没关系.
- 请注意,此新插件的ID是最新保存的版本,可在
http://run.plnkr.co/plunks/<plunkId>/[filename.ext]
上获得. - 在您的第二次抽烟中,您可以:
- 使用上述网址将指令添加到软件包目录中,然后将该新软件包添加到您的插件中;或
- 通过典型的
<script src="<url>"></script>
标签将指令脚本直接添加到您的index.html
中.
- Create your new directive as its own Plunk and make sure that it is saved. It doesn't matter if it is public or private.
- Note this new plunk's id as its latest saved version will be available at
http://run.plnkr.co/plunks/<plunkId>/[filename.ext]
- In your 2nd plunk, you can either:
- Add the directive to the package catalogue using the above url and then add that new package to your plunk; or
- Add the directive script directly to your
index.html
via a typical<script src="<url>"></script>
tag.
我认为搜索功能更好(已经在 http://explore.plunker.co 的预览中)和这种将版本标签发布到目录中的机制将为下一代在线原型制作提供一些非常酷而有效的工作流.
I think that better search capabilities (already in preview at http://explore.plunker.co) and this mechanism for publishing versioned plunks to the catalogue will allow some really cool and efficient workflows for the next generation of online prototyping.
这篇关于您可以从其他插件导入依赖吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!