diff --git a/examples/mapbox-style.html b/examples/mapbox-style.html new file mode 100644 index 0000000000..febad45936 --- /dev/null +++ b/examples/mapbox-style.html @@ -0,0 +1,32 @@ +--- +layout: example-verbatim.html +title: Vector tiles creatde from a Mapbox Style object +shortdesc: Example of using ol-mapbox-style with tiles from tilehosting.com. +tags: "fullscreen, geolocation, mobile" +cloak: + - key: lirfd6Fegsjkvs0lshxe + value: Your API key from http://tilehosting.com/ here +--- + + + + + + + Mapbox Style objects with ol-mapbox-style + + + + +
+ + + + diff --git a/examples/mapbox-style.js b/examples/mapbox-style.js new file mode 100644 index 0000000000..75d7817435 --- /dev/null +++ b/examples/mapbox-style.js @@ -0,0 +1,3 @@ +import apply from 'ol-mapbox-style'; + +apply('map', 'https://maps.tilehosting.com/styles/bright/style.json?key=ER67WIiPdCQvhgsUjoWK'); diff --git a/examples/webpack/config.js b/examples/webpack/config.js index e7c185ba60..a7ea23a2a4 100644 --- a/examples/webpack/config.js +++ b/examples/webpack/config.js @@ -1,4 +1,4 @@ -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); const ExampleBuilder = require('./example-builder'); const fs = require('fs'); @@ -33,7 +33,7 @@ module.exports = { }, optimization: { minimizer: [ - new UglifyJsPlugin({ + new TerserPlugin({ sourceMap: true, // Do not minify examples that inject code into workers exclude: [/(color-manipulation|region-growing|raster)\.js/] @@ -65,5 +65,14 @@ module.exports = { output: { filename: '[name].js', path: path.join(__dirname, '..', '..', 'build', 'examples') + }, + node: { + fs: 'empty' // required by ol-mapbox-stlye + }, + resolve: { + alias: { + // allow imports from 'ol/module' instead of specifiying the source path + ol: path.join(__dirname, '..', '..', 'src', 'ol') + } } }; diff --git a/package.json b/package.json index 973df08ec1..a5a6b5623c 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "marked": "0.5.1", "mocha": "5.2.0", "mustache": "^3.0.0", + "ol-mapbox-style": "^3.3.0", "pixelmatch": "^4.0.2", "pngjs": "^3.3.3", "proj4": "2.5.0", @@ -82,8 +83,8 @@ "rollup": "0.67.1", "serve-static": "^1.13.2", "sinon": "^6.0.0", + "terser-webpack-plugin": "^1.1.0", "typescript": "^3.1.0-dev.20180905", - "uglifyjs-webpack-plugin": "^2.0.1", "url-polyfill": "^1.0.13", "walk": "^2.3.9", "webpack": "4.25.1",