Edit

Vector tiles created from a Mapbox Style object

vectortiles mapboxstyle ol-mapbox-style maptiler

Example of using ol-mapbox-style with tiles from maptiler.com.

Example of using ol-mapbox-style with tiles from maptiler.com. Note: Make sure to get your own API key at https://www.maptiler.com/cloud/ when using this example. No map will be visible when the API key has expired.

index.html<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Vector tiles created from a Mapbox Style object</title>
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
    <style>
      .map {
        width: 100%;
        height:400px;
      }
      .ol-rotate {
        left: .5em;
        bottom: .5em;
        top: unset;
        right: unset;
      }    </style>
  </head>
  <body>
    <div id="map" class="map"></div>
    <script src="index.js"></script>
  </body>
</html>
index.jsimport 'ol/ol.css';
import apply from 'ol-mapbox-style';
import FullScreen from 'ol/control/FullScreen';

apply('map', 'https://api.maptiler.com/maps/topo/style.json?key=Get your own API key at https://www.maptiler.com/cloud/').then(function(map) {
  map.addControl(new FullScreen());
});
package.json{
  "name": "mapbox-style",
  "dependencies": {
    "ol": "6.3.1"
  },
  "devDependencies": {
    "parcel": "1.11.0"
  },
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build --experimental-scope-hoisting --public-url . index.html"
  }
}