Skip to content
A server component for server-rendering leaflet maps
JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Serve static content server-agnostically Jul 18, 2016
test Refactor to UMD for a single web/server component, and organise the f… Jul 18, 2016
.gitignore Initial commit Jul 14, 2016
.travis.yml Add a travis build Jul 15, 2016
LICENSE Initial commit Jul 14, 2016
README.md Serve static content server-agnostically Jul 18, 2016
demo.js Move to server-components-express for easier demo setup Jul 19, 2016
package.json Move to server-components-express for easier demo setup Jul 19, 2016
server-components-for-web.js

README.md

leaflet-map-server-component Build Status

A server component for server-rendering leaflet maps

How to use this component

This component statically renders a map. It uses the client-side Leaflet library, running entirely inside a Domino-based server-side DOM, serving up the rendered HTML output.

To use it, install it from NPM with npm install leaflet-map-server-component and just render:

<leaflet-map lat="41.3851" long="2.1734" zoom="12">
    <leaflet-marker lat="41.4036" long="2.1744"></leaflet-marker>
    <leaflet-marker lat="41.4225" long="2.1186"></leaflet-marker>
    <leaflet-marker lat="41.3640" long="2.1675"></leaflet-marker>    
</leaflet-map>

Don't have server components set up yet? Take a look in demo.js for a working example of the whole setup.

Want to see it in action right now? Clone this repo and run npm install && npm run dev to start the server and see the result.

Coming soon:

  • Map shape overlays
  • Magically autoresize the map when rendering
You can’t perform that action at this time.