Skip to content

Commit

Permalink
changed handling default icon URL base
Browse files Browse the repository at this point in the history
  • Loading branch information
zdila committed Jun 27, 2023
1 parent d4c0fbe commit 198abca
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ geocodingControl.addEventListener("optionsVisibilityChange", (e) => {

## POI icons and bundlers

(Skip if the component is used within Svelte webapp.)

POI icons are served from CDN per default.
If there is an requirement to serve them from a different location and the control is used in the application which is build with Web Application bundler (like Webpack, Vite) then it is necessary to do some extra cponfiguration.
Icons are bundled in the library and you can find them in `node_modules/@maptiler/geocoding-control/icons`.
Expand Down
2 changes: 1 addition & 1 deletion create-cdn-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ git reset maptiler-geocoding-control/v$VERSION/*.tgz

git commit -m "Add maptiler-geocoding-control v$VERSION"

gh pr create --base main --fill --repo maptiler/cdn.maptiler.com --reviewer "@petrsloup"
gh pr create --base main --fill --repo maptiler/cdn.maptiler.com
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"scripts": {
"dev": "vite --host",
"build": "npm run check && concurrently --names \"SVELTE ,MAPLIBRE,MAPTILER,MAPLIB-C,LEAFLET ,LEAFLE-C,REACT ,TYPES \" \"npm run build-svelte\" \"npm run build-maplibre\" \"npm run build-maptilersdk\" \"npm run build-maplibre-controller\" \"npm run build-leaflet\" \"npm run build-leaflet-controller\" \"npm run build-react\" \"npm run build-types\" && npm run cjs2js && cp dist.svelte/*.svelte* LICENSE README.md package.json dist",
"build-svelte": "svelte-package -o dist.svelte && VITE_FLAVOUR= VITE_LIB_VERSION=$npm_package_version node replace-env-vars.js",
"build-maptilersdk": "VITE_FLAVOUR=maptilersdk vite build",
"build-maplibre": "VITE_FLAVOUR=maplibre vite build",
"build-maplibre-controller": "VITE_FLAVOUR=maplibregl-controller vite build",
"build-leaflet": "VITE_FLAVOUR=leaflet vite build",
"build-leaflet-controller": "VITE_FLAVOUR=leaflet-controller vite build",
"build-react": "VITE_FLAVOUR=react vite build",
"build-svelte": "svelte-package -o dist.svelte && VITE_LIB_VERSION=$npm_package_version node replace-env-vars.js",
"build-maptilersdk": "FLAVOUR=maptilersdk vite build",
"build-maplibre": "FLAVOUR=maplibre vite build",
"build-maplibre-controller": "FLAVOUR=maplibregl-controller vite build",
"build-leaflet": "FLAVOUR=leaflet vite build",
"build-leaflet-controller": "FLAVOUR=leaflet-controller vite build",
"build-react": "FLAVOUR=react vite build",
"build-types": "tsc --outDir dist --declaration --emitDeclarationOnly",
"cjs2js": "renamer --find '/\\bcjs\\b/' --replace js dist/*cjs*",
"clean": "rm -rf dist dist.svelte",
Expand Down
9 changes: 4 additions & 5 deletions src/lib/GeocodingControl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@
export let fetchParameters: RequestInit = {};
export let iconsBaseUrl = import.meta.env.VITE_FLAVOUR
? "https://cdn.maptiler.com/maptiler-geocoding-control/v" +
import.meta.env.VITE_LIB_VERSION +
"/icons/"
: "icons/";
export let iconsBaseUrl =
"https://cdn.maptiler.com/maptiler-geocoding-control/v" +
import.meta.env.VITE_LIB_VERSION +
"/icons/";
export function focus() {
input.focus();
Expand Down
12 changes: 6 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@ export default defineConfig({
emptyOutDir: false,
lib:
// simplify after https://github.com/vitejs/vite/pull/10609 is released
process.env.VITE_FLAVOUR === "leaflet"
process.env.FLAVOUR === "leaflet"
? {
fileName: "leaflet",
entry: ["src/lib/leaflet.ts"],
name: "leafletMaptilerGeocoder",
formats: ["es", "umd"],
}
: process.env.VITE_FLAVOUR === "maplibre"
: process.env.FLAVOUR === "maplibre"
? {
fileName: "maplibregl",
entry: ["src/lib/maplibregl.ts"],
name: "maplibreglMaptilerGeocoder",
formats: ["es", "umd"],
}
: process.env.VITE_FLAVOUR === "maptilersdk"
: process.env.FLAVOUR === "maptilersdk"
? {
fileName: "maptilersdk",
entry: ["src/lib/maptilersdk.ts"],
name: "maptilersdkMaptilerGeocoder",
formats: ["es", "umd"],
}
: process.env.VITE_FLAVOUR === "react"
: process.env.FLAVOUR === "react"
? {
fileName: "react",
entry: ["src/lib/react.ts"],
name: "MapTilerGeocoder",
formats: ["es", "umd"],
}
: process.env.VITE_FLAVOUR === "leaflet-controller"
: process.env.FLAVOUR === "leaflet-controller"
? {
fileName: "leaflet-controller",
entry: ["src/lib/leaflet-controller.ts"],
name: "leafletMaptilerGeocodingController",
formats: ["es", "umd"],
}
: process.env.VITE_FLAVOUR === "maplibregl-controller"
: process.env.FLAVOUR === "maplibregl-controller"
? {
fileName: "maplibregl-controller",
entry: ["src/lib/maplibregl-controller.ts"],
Expand Down

0 comments on commit 198abca

Please sign in to comment.