Skip to content

Commit

Permalink
Minify SVG images and add rules for High Contrast mode on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Oct 23, 2019
1 parent 5f03976 commit 81ab1b3
Show file tree
Hide file tree
Showing 19 changed files with 387 additions and 127 deletions.
5 changes: 4 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"declaration-block-semicolon-newline-after": "always-multi-line",
"block-opening-brace-space-before": "always-multi-line",
"declaration-block-single-line-max-declarations": 3,
"selector-class-pattern": "mapboxgl-[a-z-]+"
"selector-class-pattern": "mapboxgl-[a-z-]+",
"at-rule-no-unknown": [true, {
"ignoreAtRules": ["svg-load"]
}]
}
}
60 changes: 60 additions & 0 deletions debug/controls.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel='stylesheet' href='../dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }

#checkboxes {
position: absolute;
background: #fff;
top:0;
left:0;
padding:10px;
}
</style>
</head>

<body>
<div id='map'></div>
<div id='checkboxes'>
<label><input id='show-tile-boundaries-checkbox' type='checkbox'> tile debug</label><br />
<label><input id='show-symbol-collision-boxes-checkbox' type='checkbox'> collision debug</label><br />
<label><input id='show-overdraw-checkbox' type='checkbox'> overdraw debug</label><br />
<label><input id='pitch-checkbox' type='checkbox' checked> pitch with rotate</label><br />
</div>

<script src='../dist/mapbox-gl-dev.js'></script>
<script src='../debug/access_token_generated.js'></script>
<script>

var map = window.map = new mapboxgl.Map({
container: 'map',
zoom: 12.5,
center: [-77.01866, 38.888],
style: 'mapbox://styles/mapbox/streets-v10',
hash: true
});

map.addControl(new mapboxgl.NavigationControl());
map.addControl(new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true,
showUserLocation: true,
fitBoundsOptions: {
maxZoom: 20
}
}));
map.addControl(new mapboxgl.ScaleControl());
map.addControl(new mapboxgl.FullscreenControl());


</script>
</body>
</html>
1 change: 1 addition & 0 deletions debug/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
}
}));
map.addControl(new mapboxgl.ScaleControl());
map.addControl(new mapboxgl.FullscreenControl());

map.on('load', function() {
map.addSource('geojson', {
Expand Down
12 changes: 11 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
module.exports = {
plugins: [
require('postcss-inline-svg'),
require('cssnano')
require('cssnano')({
preset: ['default', {
svgo: {
plugins: [{
removeViewBox: false
}, {
removeDimensions: false
}],
},
}],
}),
]
}
Loading

0 comments on commit 81ab1b3

Please sign in to comment.