-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Discussion: mapbox controls #8767
Comments
@Bravecow Thank you for starting this discussion, and sharing the gl-controls repo. We have recently had internal discussions about bundle size and plugin maintenance and are looking to incorporate some of that work into our roadmap for the rest of the year.
Have you tried this? What sort of size reduction were you able to achieve by removing the controls. Only the Navigation, Geolocate, Fullscreen, and Scale controls would be removable.
👍
While it would be a breaking change to move the existing controls, moving the other plugins might be a good way to start this. |
So -30KB of minified JS. Do not know is it a lot according to your measurements 🤷♂ |
At the moment, it's possible for someone to reskin GL JS by just replacing the dist mapbox-gl.css with their own, it sounds like your suggesting embedding the CSS within the JS code, is that right? That would make re-skinning much harder?
That's because we use postcss's load-svg. The dist css should be valid, is there an issue with the sources using load-svg? The main advantage I see of using load-svg, compared to https://github.com/bravecow/mapbox-gl-controls/blob/master/src/ruler/icon-ruler.js, is we can maintain the icons as SVG files at https://github.com/mapbox/mapbox-gl-js/tree/master/src/css/svg which can be opened directly in vector graphics software, easier to inspect/open, lint, etc.
Although fragmented, I'd prefer keeping Mapbox's controls in separate repos, as is currently done. It's easier to track issues and PRs releases for people who may only use a subset of the controls/plugins. We should be able to unify the workflow regardless of separate repo or not.
which icons result in extra GET requests? |
no, only to put SVG icons inside
Code highlighting of CSS source file is broken in code editors.
You are right. I'm pretty sure converting import rulerIcon from './ruler-icon.svg';
button.appendChild(rulerIcon());
If some user have an idea for a new control, a new project should be made from the very beginning (in case there is not any
Ah, I forgot that icons are inlined in CSS file as base64 here. Thanks, there is no extra GET request 👍
Absolutely. Don't get me wrong, I'm not trying to tell how cool I am here or any other kind of offense. I just see that controls / plugins is something that should be improved and trying to help. Yesterday my customized |
@andrewharvey struck out about additional GET requests 🙄 |
Already done: https://github.com/bravecow/mapbox-gl-controls/blob/master/src/compass/icon-pointer.svg Wrote simple rollup converter: https://github.com/bravecow/rollup-inline-svg |
oh right, so instead of a
A template repo would be useful. |
nope. only Would be something like this: .mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate svg {
fill: #333;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate:disabled svg {
fill: #aaa;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active svg{
fill: #33b5e5;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error svg{
fill: #e58978;
} So does inlining makes changing icons hard? Do not think so. It just moves to JS instead of CSS. |
FYI: Rollup moves all official plugins to monorepo: |
After ~4 years my suggestion slightly changed to the side as it does rollup plugins: monorepo + pnpm. But still think it is a good idea to remove controls from core and structure them (e.g. 'official' draw control and fullscreen control have different icon size and color). Especially now, when a new major release is coming. |
Hi. I have some controls for personal usage.
What I like about them:
mapbox now have 600-lines CSS
no additional GET request for each resourceAs result:
svg-load
pluginremove some GET requests for iconsThe text was updated successfully, but these errors were encountered: