Search code examples
browserifymapbox-gl-js

How can I build mapbox-gl.js with Browserify?


If I git clone the repo (from mapbox-gl.js repo), how can I build my own standalone version of the files?

I just need the standalone mapbox-gl.js, like this one.

A simple browserify js/mapbox-gl.js -o dist/mapbox-gl.js does not work.


Solution

  • I just added a section to the mapbox-gl-js readme on this topic.

    Creating a Standalone Build

    A standalone build allows you to turn the contents of this repository into mapbox-gl.js and mapbox-gl.css files that can be included on an html page.

    To create a standalone build, run bash npm run production

    Once that command finishes, you will have a standalone build at dist/mapbox-gl.js and dist/mapbox-gl.css

    I hope that helps! Let me know if you have any follow-up questions.