$(document).ready -> if $('#map').size() > 0 map = L.map('map').setView [46.5, 4], 6 L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', id: 'examples.map-i86knfo3', attribution: 'Map data © OpenStreetMap contributors, ' + 'CC-BY-SA, ' + 'Imagery © Mapbox' ).addTo map $.getJSON '/maps.json', (json) -> L.geoJson(json, onEachFeature: (feature, layer) -> # Does this feature have a property named popupContent? if (feature.properties && feature.properties.popupContent) layer.bindPopup(feature.properties.popupContent) ).addTo map