Mapbox JavaScript API, a Leaflet Plugin
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_docs slashes for leflet too Oct 25, 2016
docs Update page shell Sep 19, 2018
src Merge pull request #1196 from calvinmetcalf/no-format Feb 7, 2017
test Replace instances of `map-feedback` with `feedback` May 23, 2017
theme tweak size + padding Apr 18, 2017
.eslintrc Switch from jshint to eslint. Fixes #1026 Jun 16, 2015
.gitignore Adds build script to create and publish the bower repo Jul 25, 2014
.travis.yml Implement jsfiddle integration for quickly testing examples Sep 8, 2014
API.md change endpoint naming Aug 21, 2017
CHANGELOG.md Prepare mapbox.js@3.1.1 May 23, 2017
DEPLOYING.md Update deploying docs for mb-pages Sep 2, 2015
DESIGN.md revert rename Dec 10, 2013
DOCUMENTING.md how to update mapbox.com Nov 2, 2015
FAQ.md revert rename Dec 10, 2013
JS.md Rename markerLayer to featureLayer Feb 19, 2014
LICENSE.md revert rename Dec 10, 2013
Makefile Remove render.sh script from dist folder Apr 19, 2016
README.md Fix broken paths to assets Apr 15, 2017
_config.dev-pages.yml Publish v3.1.1 docs May 23, 2017
_config.mb-pages.yml Publish v3.1.1 docs May 23, 2017
_config.yml Publish v3.1.1 docs May 23, 2017
bower-utils.inc Adds build script to create and publish the bower repo Jul 25, 2014
bower.json - added 'images/*' to bower.json main section. Feb 15, 2015
bower.sh Add .map files to future bower releases. Fixes #989 Apr 27, 2015
deploy.sh fix(cdn): Deploy dark SVG icons Nov 28, 2016
jekyll.sh Fix broken paths to assets Apr 15, 2017
package.json Prepare mapbox.js@3.1.1 May 23, 2017

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, with code snippets available on the official documentation page

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
  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.

Running docuemntation locally

Documentation is powered by Jekyll. Running using the following command:

./jekyll.sh