Third-party patches are absolutely essential on our quest to create the best mapping library that will ever exist. However, they're not the only way to get involved with the development of Leaflet. You can help the project tremendously by discovering and reporting bugs, improving documentation, helping others on the Leaflet forum and GitHub issues, showing your support for your favorite feature suggestions on Leaflet UserVoice page, tweeting to @LeafletJS and spreading the word about Leaflet among your colleagues and friends.
Before reporting a bug on the project's issues page, first make sure that your issue is caused by Leaflet, not your application code (e.g. passing incorrect arguments to methods, etc.). Second, search the already reported issues for similar cases, and if it's already reported, just add any additional details in the comments.
After you made sure that you've found a new Leaflet bug, here are some tips for creating a helpful report that will make fixing it much easier and quicker:
git bisect
to find the exact commit that introduced the bug.If you just want some help with your project, try asking on the Leaflet forum instead.
While we happily accept patches, we're also commited to keeping Leaflet simple, lightweight and blazingly fast. So bugfixes, performance optimizations and small improvements that don't add a lot of code are much more likely to get accepted quickly.
Before sending a pull request with a new feature, first check if it's been discussed before already (either on GitHub issues or Leaflet UserVoice), and then ask yourself two questions:
If your feature or API improvement did get merged into master, please consider submitting another pull request with the corresponding documentation update.
To set up the Leaflet build system, install Node, then run the following commands in the project root:
npm install -g jake
npm install
You can build minified Leaflet by running jake
(it will be built from source in the dist
folder).
For a custom build with selected components, open build/build.html
in the browser and follow the instructions from there.
If you're not yet familiar with the way GitHub works (forking, pull requests, etc.), be sure to check out the awesome article about forking on the GitHub Help website — it will get you started quickly.
You should always write each batch of changes (feature, bugfix, etc.) in its own topic branch.
Please do not commit to the master
branch, or your unrelated changes will go into the same pull request.
You should also follow the code style and whitespace conventions of the original codebase. In particular, use tabs for indentation and spaces for alignment.
Before commiting your changes, run jake lint
to catch any JS errors in the code and fix them.
If you add any new files to the Leaflet source, make sure to also add them to build/deps.js
so that the build system knows about them.
Also, please make sure that you have line endings configured properly in Git! Otherwise the diff will show that all lines of a file were changed even if you touched only one.
Happy coding!
To run the tests from the command line,
install PhantomJS (and make sure it's in your PATH
),
then run:
jake test
To run all the tests in actual browsers at the same time, you can do:
jake test --ff --chrome --safari --ie
To run the tests in a browser manually, open spec/index.html
.
To generate a detailed report about test coverage (which helps tremendously when working on test improvements), run:
jake test --cov
After that, open spec/coverage/<environment>/index.html
in a browser to see the report.
From there you can click through folders/files to get details on their individual coverage.
The code of the live Leaflet website that contains all documentation and examples is located in the gh-pages
branch
and is automatically generated from a set of HTML and Markdown files by Jekyll.
The easiest way to make little improvements such as fixing typos without even leaving the browser
is by editing one of the files with the online GitHub editor:
browse the gh-pages branch,
choose a certain file for editing (e.g. reference.html
for API reference),
click the Edit button, make changes and follow instructions from there.
Once it gets merged, the changes will immediately appear on the website.
If you need to make edits in a local repository to see how it looks in the process, do the following:
gem install jekyll
.jekyll serve --watch
in the root Leaflet
folder.localhost:4000
in your browser.Now any file changes will be updated when you reload pages automatically. After commiting the changes, just send a pull request.
If you need to update documentation according to a new feature that only appeared in the master version (not stable one),
you need to make changes to gh-pages-master
branch instead of gh-pages
.
It will get merged into the latter when released as stable.
Not only are we grateful for any contributions, — helping Leaflet and its community actually makes you AWESOME. Join this approved list of awesome people and help us push the limits of what's possible with online maps!