- The structure of an example is
_posts/examplename/0100-01-01-examplename.html. - All files necessary for examples must be in their own directory.
- Examples use hosted mapbox.js, with the latest deployed version.
- Use the AirBnb style guide styles, but with 4 spaces not 2.
- Example code should pass jshint
- Where possible, examples should be cross-browser and touch-compatible.
- Use long, descriptive names for variables.
- Add comments for pitfalls where users might run into problems, and for parts of the code that users will need to modify to get things working.
To create a new example, git clone this branch:
git clone -b gh-pages git@github.com:mapbox/mapbox.js.git mapbox.js-site cd mapbox.js-site
You will need jekyll installed.
Run the site:
jekyll serve -w -p 4000
Edit the site. Existing examples are located here - copy one to a new file with the same naming convention to start a new example. Test your new example by going to http://localhost:4000/mapbox.js/ and finding and using it.
When you're done,
git add _posts/...newexample
git commit -m "Added a new example, showing off XYZ"
git push origin gh-pages
- The version tag is updated in the
_config.ymlfile underversion:. - Rebuild the docs
cd _docs && ./build.sh VERSION - Each example should be tested against the version change.