nmccready / cesium-navigation

Cesium plugin that adds to the Cesium map a compass, navigator (zoom in/out), and distance scale.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trim Fat: do we really need all the libraries?

nmccready opened this issue · comments

  • almond
  • kockout * ext
  • hammer see here
  • markdownit & ext (sanitize)

If they are not needed they should be erased as they create bundle bloat.

Current thoughts:

Maybe keep hammer as the touch API might be relevant. Needs exploring.

+1. I was going to open this issue - glad to see it already exists! Specifically, looking at the deps:

"almond": "^0.3.2",
// I believe this is used for building, which is not needed now with rollup.

"cesium": "^1.48",
// ok guess we need this one :)

"markdown-it": "^7.0.0",
"markdown-it-sanitizer": "^0.4.1"
// looks like its registered but not used? Not sure on this one - I can't imagine a case where this pluging would need markdown support. If we removed Knockout this would all go away for free. 

"knockout": "^3.4.0",
"knockout-es5": "^0.4.4",
// if we remove this it would make sense to port to React. Would clean up the code quite a bit, especially using proptypes instead of all those nasty undefined declarations. Not a bad idea IMO but not sure its worth the effort? 

"hammerjs": "^2.0.8",
// this is for touch and hover magic. I have not looked into how its used in this repo, but in my experience you only need hammerjs if you are doing mobile or more complex hover / mouse interaction stuff. I would be surprised if we lost anything really if removed. It might be different in Knockout land though...

I have not looked at the dev deps but that is less of a concern.

But Bower def we don't need.

Bower

But Bower def we don't need.

Bower has been long gone as it is one of the first things I removed.

I am against adding react unless we absolutely have to. I would bet we can do everything with raw javascript and html without any fancy framework.

If it becomes a total pain in the rear, only then will I consider depending on react.

Re: Bower - yup its gone, I must have been looking at the original library/.

Re: React - makes sense. Keep in mind Knockout is still a fancy UI framework too :) I doubt though it needs either, and making it vanilla JS would be more "cesium like" anyhow.

Re: Markdown - yes I see its registered, so it is being used in the code per say. But my comment was other than being registered, I don't think there IS a need for it. Where would the component use markdown? I feel like this is lingering from some copy-paste example.

And re: react, while you are "against" it remember we are using this module in a react based project, so depending on two JS frameworks (sure, even though Knockout claims to be lightweight) seemed silly.

But I agree that porting to plain JS would be most useful for the Cesium community, because then anyone could use this without needing to worry about bringing another JS library into their project.

Re: Markdown - yes I see its registered, so it is being used in the code per say. But my comment was other than being registered, I don't think there IS a need for it. Where would the component use markdown? I feel like this is lingering from some copy-paste example.

Right agreed, I just don't want to remove it until it's confirmed how it's used.