PLUGIN-GUIDE.md

# Leaflet Plugin Authoring Guide
#枫叶插件权威指南
One of the greatest things about Leaflet is its powerful plugin ecosystem.
关于Leaflet最强大的一点就是它强大的插件生态系统。
The [Leaflet plugins page](http://leafletjs.com/plugins.html) lists dozens of awesome plugins, and more are being added every week.
Leaflet插件页面(http://leafletjs.com/plugins.html)列出了几十种很棒的插件,每周都会添加新的。
This guide lists a number of best practices for publishing a Leaflet plugin that meets the quality standards of Leaflet itself.
该指南列出了发布满足Leaflet质量标准的Leaflet插件的几个最强实践。
Contents目录
1. [Presentation](#presentation)
- [Repository](#repository)
- [Name](#name)
- [Demo](#demo)
- [Readme](#readme)
- [License](#license)
2. [Code](#code)
- [File Structure](#file-structure)
- [Code Conventions](#code-conventions)
- [Plugin API](#plugin-api)
3. [Publishing on NPM](#publishing-on-npm)
4. [Module Loaders](#module-loaders)
5. [Adding to the plugins list](#adding-to-the-plugins-list)
1.【演示文稿】(#演示文稿)
-[存储库](#存储库)
-[姓名](#姓名)
-[演示](#演示)
-[自述](#自述)
-[许可证](#许可证)
2.[代码](#代码)
-[文件结构](#文件结构)
-[代码约定](#代码约定)
-[插件API](#插件API)
3.【NPM发布】(#NPM发布)
4.[模块加载器](#模块加载器)
5.[添加到插件列表](#添加到插件列表)
## Presentation
##演示文稿
### Repository
###存储库
The best place to put your Leaflet plugin is a separate [GitHub](http://github.com) repository.
放置Leaflet插件最好的地方就是一个单独的Github仓库。
If you create a collection of plugins for different uses,如果你为不同的用途创建了好几个插件,
don't put them in one repo —最好不要把它们都放在一个Github仓库里,
it's usually easier to work with small, self-contained plugins in individual repositories.因为单独的仓库工作起来更方便。
### Name姓名
Most existing plugins follow the convention of naming plugins (and repos) like this: `Leaflet.MyPluginName`.
You can use other forms (e.g. "leaflet-my-plugin-name"),
just make sure to include the word "Leaflet" in the name so that it's obvious that it's a Leaflet plugin.
大多数现有的插件都遵循这样命名插件(和repos)的惯例:`传单.MyPluginName`.
您可以使用其他形式(例如“传单我的插件名”),
只需确保在名称中包含“传单”一词,以便很明显它是一个传单插件。
### Demo
The most essential thing to do when publishing a

这篇指南列举了发布高质量Leaflet插件的最佳实践,包括创建单独的GitHub仓库、遵循特定命名规则、提供演示、编写清晰的Readme、选择合适的许可证、保持代码简洁结构、遵循代码规范、设计插件API等。还提到了通过NPM发布、支持模块加载器以及如何将插件添加到官方插件列表中。
最低0.47元/天 解锁文章
1095

被折叠的 条评论
为什么被折叠?



