Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve styles #1607

Open
artyomb opened this issue Dec 9, 2024 · 4 comments
Open

Serve styles #1607

artyomb opened this issue Dec 9, 2024 · 4 comments

Comments

@artyomb
Copy link

artyomb commented Dec 9, 2024

Is it possible to configure support for serving static files or Mapbox-style JSON files using a configuration file?

static:
 - /path/to/static_dir

or

styles:
 - /path/to/styles_dir

Additionally, when serving Mapbox-style JSON files specifically, could the system automatically add related fonts, sprites, and sources to the file?

@CommanderStorm
Copy link
Collaborator

when serving Mapbox-style JSON files specifically, could the system automatically add related fonts, sprites, and sources to the file?

This part is a bit unclear, what do you mean by this specifically?

And yes, adding styles would defintively be required to implement this feature:

@artyomb
Copy link
Author

artyomb commented Dec 9, 2024

The following sections could be added automatically:

mapbox_style.json:

...
"glyphs": ".../fonts/{fontstack}/{range}.pbf",
"sprite": ".../sprites",
...
"sources": [
    "source_name": {
      "type": "vector",
      "url": "/tiles/.../tiles.json"
    },
]

@CommanderStorm
Copy link
Collaborator

I don't think that this would work as you intended. We would need to

  • (solvable) pick source_name dependent on the stlyes usage
  • decide if the user wants sdf or regular sprites
  • decide which vector/sprite source a user needs to display the map they want

In particular because of the last issue, we would need to do the wrong kind of magic. I.e. the kind which does unintended things easily and is hard to debug our users).
=> I think our users will be much less confused without automatically adding this information

@artyomb
Copy link
Author

artyomb commented Dec 11, 2024

This feature could be optional. Styles are typically served as static files, but they may also support templating, such as:

...
"glyphs": "{{ .Fonts }}",
"sprite": "{{ .SdfSprites.base }}",
...
"sources": [
  {{range .Sources}}
    "{{.Name}}": {
      "type": "vector",
      "url": "{{.TileJson}}"
    },
  {{end}}
]

@CommanderStorm CommanderStorm changed the title Serve static files or Style.json Serve styles Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants