HTML JavaScript CSS PHP Other
Latest commit 46d40da Feb 17, 2017 @lyzidiamond lyzidiamond committed on GitHub Merge pull request #1212 from mapbox/rotate-tokens-feb-2017
Rotate mapbox.js access token
Permalink
Failed to load latest commit information.
_docs slashes for leflet too Oct 25, 2016
docs Updated docs/_layouts/default.html Feb 16, 2017
src Merge pull request #1196 from calvinmetcalf/no-format Feb 7, 2017
test rotate token Feb 16, 2017
theme Add marker-shadow to theme/images Nov 21, 2016
.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 Remove InfoControl Oct 20, 2016
CHANGELOG.md Changelog to 3.0.1 Nov 21, 2016
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 Use SVGs with PNG fallbacks for toolbar icons Apr 19, 2016
_config.dev-pages.yml Update docs to 3.0.1 Nov 21, 2016
_config.mb-pages.yml rotate token Feb 16, 2017
_config.yml Update docs to 3.0.1 Nov 21, 2016
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
package.json docs(changelog): Use commitizen style commit messages Nov 28, 2016

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.