Leaflet – How to Install Leaflet Search Plugin Without Using Npm

leafletnode-jssearch

I am not familiar with Node.js or npm at all, but my IT has told me node.js/npm is not compatible with our IIS, and the only search plugins to add on to leaflet are using npm to install them.

I did a search here and found this solution without npm – leaflet-control-geocoder, but it searches address databases such as google or bing, not the geojson data I have plugged into my map that I need to be able to search.

So my question is, is there a way to use the Leaflet Search plugin or leaflet-fusesearch plugin without using npm to install it?

Best Answer

I'm assuming that you want to use the leaflet-search plugin, without using NPM. This is possible, using these steps:

  1. Go to https://github.com/stefanocudini/leaflet-search
  2. Click on the Clone or download button, and download as Zip
  3. Unzip the downloaded file.
  4. Copy the dist & the images folder to your application.
  5. In your Application's HTML file, add links to the CSS and JS file which are present in the dist folder (i.e. leaflet-search.min.css & leaflet-search.min.js).
  6. You should now be able to access the L.Control.Search object in your JavaScript code.
Related Question