Closed erictheise closed 4 years ago
@erictheise To clarify, these values would all end up in the transpiled JavaScript file? If so I can do a little research to see what would work best with our build system.
@greatislander, of the values I mentioned (and I left one out), the Mapbox accessToken
and style
url are in maps/static/maps/js/app.js
and would be transpiled. glyphs
and sprite
are part of the JSON-formatted Mapbox style documents, which you can see in maps/static/maps/styles/pcc/style.json
on the add/pcc-map-styles
branch. I have been bringing those over using
mix.copyDirectory('maps/static/maps/styles', 'maps/static/maps/dist/styles');
in webpack.mix.js
but I defer to your assessment as to whether that's the optimal approach.
Thanks @erictheise, duly noted. I'm working on the impact summary at the moment but I will make some time to look into this later and get back to you.
Is your feature request related to a problem? Please describe.
Several values related to maps should vary depending on where the code is running. The Mapbox token is one example although there seems little harm in hardcoding that. Others are the
sprite
andglyphs
urls in the Mapbox style JSON document. These should be configurable for development and production environments. For example, in productionshould be the correct url but for my own development purposes, as I serve many glyphs across many projects, I would like to use
and not have to worry about fiddling with these values before and after a commit.
Describe the solution you'd like
The ability to work easily and without fear of committing an invalid map style to the repo.
Describe alternatives you've considered
My first attempts at introducing a JavaScript workflow to this Django project brought in a package called
envify
. @greatislander queried me about it somewhere along the way and it's been removed; I kept it solely as a reminder that parsing config values would be necessary at some point. I don't even know if that package serves the purpose although the name suggested it might.