Skip to content
Mapbox JavaScript API, a Leaflet Plugin
HTML JavaScript CSS PHP Shell Makefile Ruby
Failed to load latest commit information.
_docs adds version # to description in generate.js
docs Updated docs/_layouts/default.html
src Merge pull request #1092 from nyurik/mb-pages
test Add L.mapbox.styleLayer
theme Responsive attribution
.eslintrc Switch from jshint to eslint. Fixes #1026
.gitignore Adds build script to create and publish the bower repo
.travis.yml Implement jsfiddle integration for quickly testing examples
API.md coordinate rounding
CHANGELOG.md Update CHANGELOG.md
DEPLOYING.md Update deploying docs for mb-pages
DESIGN.md revert rename
DOCUMENTING.md how to update mapbox.com
FAQ.md revert rename
Gemfile Update Gemfile
Gemfile.lock Update Gemfile
JS.md Rename markerLayer to featureLayer
LICENSE.md revert rename
Makefile Minify with minifyify rather than piping to uglifyjs
README.md Update tile API in readme
_config.dev-pages.yml Add docs for v2.3.0.
_config.mb-pages.yml Add docs for v2.3.0.
_config.yml Add docs for v2.3.0.
bower-utils.inc Adds build script to create and publish the bower repo
bower.json - added 'images/*' to bower.json main section.
bower.sh Add .map files to future bower releases. Fixes #989
config.ru Add config.ru for pow
deploy.sh Minify with minifyify rather than piping to uglifyjs
package.json 2.3.0

README.md

mapbox.js

Build Status Average time to resolve an issue

This is the Mapbox Javascript API, version 2.x. It's built as a Leaflet plugin. You can read about its launch.

API

Managed as Markdown in API.md, following the standards in DOCUMENTING.md

Examples

Usage

Recommended usage is via the Mapbox CDN:

<script src='https://api.mapbox.com/mapbox.js/v2.2.1/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.1/mapbox.css' rel='stylesheet' />

The mapbox.js file includes the Leaflet library. Alternatively, you can use mapbox.standalone.js, which does not include Leaflet (you will have to provide it yourself).

See the API documentation and Examples for further help.

Usage with Browserify

Install the mapbox.js module and add it to dependencies in package.json:

npm install mapbox.js --save

Require mapbox in your script:

// main.js

require('mapbox.js'); // <-- auto-attaches to window.L

Browserify it:

browserify main.js -o bundle.js

Usage with Bower

You can install mapbox.js with bower by running

bower install mapbox.js

Usage as Download

You can download a built release at the mapbox.js-bower repository.

Building

Requires node.js installed on your system.

git clone https://github.com/mapbox/mapbox.js.git
cd mapbox.js
npm install
make

This project uses browserify to combine dependencies and installs a local copy when you run npm install. make will build the project in dist/.

Tests

Test with phantomjs:

npm test

To test in a browser, run a local development server and go to /test.

Version v0.x.x

Version v0.x.x can be accessed in the v0 branch..

Editing Icons

Requirements:

inkscape
pngquant
convert (part of imagemagick)
  1. Make edits to theme/images/icons.svg.
  2. Run ./theme/images/render.sh to update sprites from your edits.
  3. Add a CSS reference with the appropriate pixel coordinate if adding a new icon.
Something went wrong with that request. Please try again.