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

Too many jQuery libraries are loading...... #38

Closed
Andries-Smit opened this issue Apr 23, 2016 · 3 comments
Closed

Too many jQuery libraries are loading...... #38

Andries-Smit opened this issue Apr 23, 2016 · 3 comments
Assignees

Comments

@Andries-Smit
Copy link
Contributor

There is no way around it, all projects do contain a lot widgets. And many of those widgets have a jQuery Library in them. Within the current design, every widget includes their own version, and quite often not even minimized.

Before a new users session can start, the browser needs to download all of them. With mobile and even sometimes on a desktop this takes longer that patience of its users. This not nice and unnecessary.

The end user will blame Mendix, and Mendix will blame the developer....

We should re-thing the way of using jQuery!

  • Does a widget need jQuery, for simile dom manipulations?
  • Is there a way, we could share jQuery libs across widgets?
  • Should widgets in the app store be minimized before approval?
  • Can we change the most common widgets to use the same version of jQuery?
  • Could the modeler and runtime be shipped with a jQuery library?
@JelteMX JelteMX self-assigned this Apr 23, 2016
@JelteMX
Copy link
Contributor

JelteMX commented Apr 23, 2016

As I am going to refactor the Boilerplate soon, this a fairly good point.

  • For DOM manipulation you can use Dojo, which has all the features that jQuery can do. So no, jQuery is not needed. In the widget generator this will be optional and not encouraged.
  • A lot of the older libraries that widgets have, depend on jQuery. So including jQuery is a necessity then. The problem with that is that each widget will have their own copy (Widget/lib/jquery) which is not shared indeed
  • Minified libraries have posed problems in the past, because Dojo Build would fail when it would try to bundle the widgets.

There is not a simple way to get around it.

  • Minified libraries and widgets should be the standard. So in that sense I agree with you we should have developers have their widgets minified.
  • Upon approval, we do check the code of widgets. If I see there is no need to include jQuery, I prefer to dismiss the approval and point out that it should be cleaned up.
  • Personally I want to see less and less jQuery in our widgets.

Another option for jQuery (which isn't entirely friendly) would be a different widget that is only included for their libraries:

  1. You create a widget called "Libraries" that is included in your project (has to be on one of the pages or a template so it's included in widgets.js)
  2. Libraries is a simple widget that will ship jQuery
  3. Other widgets can refer to "Libraries/lib/jQuery" and thus share the library, that will only be included once

I am going to check with R&D whether or not we can find a viable solution. I'll ask them to join the discussion, as I am not the expert on Dojo build, the process that is used by the Modeler to bundle widgets.

@Achiel
Copy link
Contributor

Achiel commented Apr 28, 2016

As I mentioned on the forum topic: we minify widgets during the build step. You should not (and are urged not to) bundle minified libs with your widgets.

@JelteMX
Copy link
Contributor

JelteMX commented Oct 17, 2016

Added options to version 2.0.0 of the widget generator whether or not to include jQuery or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants