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

Problem With AMD Instructions #711

Open
machineghost opened this issue Apr 10, 2016 · 8 comments
Open

Problem With AMD Instructions #711

machineghost opened this issue Apr 10, 2016 · 8 comments
Labels

Comments

@machineghost
Copy link

The AMD instructions for using jQuery UI (https://learn.jquery.com/jquery-ui/environments/amd/) assume that you have a whole bunch of separate files, one for each jQuery UI component (autocomplete.js, dialog.js, etc.).

However, jQuery UI doesn't come packaged that way (maybe it's possible with the download builder, but the instructions on the page I linked go out of their way to say that the download builder shouldn't be needed). Instead, it comes with a single file for the entire library (jquery-ui.js).

Could you please update these instructions to reflect the single file nature of today's jQuery UI, or else explain on those instructions where one needs to go to get the special AMD version of jQuery UI (ie. the one with separate files for each component). I'm hoping the former is possible, as having to keep a separate file for each component doesn't seem like the best idea performance-wise.

Thanks!

@scottgonzalez
Copy link
Member

How are you getting the files?

From the Requirements section at the top of the article:

... you can download the jQuery UI source files from https://github.com/jquery/jquery-ui/releases (use the files in the ui directory). You can alternatively download these libraries using a package manager such as Bower.

@machineghost
Copy link
Author

Ah, that's the problem: I downloaded from https://jqueryui.com/. Thanks.

While that's definitely my fault for not reading the instructions, at the same time it seems like a mistake a lot of people would make (since normally one can download a library from its own website). You might want to consider drawing more attention to that part (just a suggestion).

@scottgonzalez
Copy link
Member

My impression is that most developers who use AMD do not manually download libraries from web sites; they use package managers.

@machineghost
Copy link
Author

For what it's worth, I'm not sure that is a correct impression. Developers using AMD are almost exclusively using Require.js ... which is to say they're one step up from <script> tags. In fact, I've seen multiple Require-using codebases that haven't even fully transitioned, and still use <script> tags to bring in some code (like, say, their 3rd party libraries).

So, while I'm not trying to stereotype AMD/Require developers as Luddites or anything, if they were the kind of people who were eager to be using the latest technologies (such as NPM for handling client-side 3rd party libraries), they wouldn't be using Require: they'd be using Webpack or JSPM or something along those lines.

For this reason, I'd be very surprised to learn that NPM-using developers were even close to a majority of all Require developers.

@scottgonzalez
Copy link
Member

I expect you'll be very surprised then.

@agcolom agcolom added the GSOC label May 4, 2016
@connorcartwright
Copy link

Hey @scottgonzalez

Do you think it's worth adding emphasis to the jQuery UI download link, like:

If you don't have a version of jQuery core handy, you can get it from http://jquery.com/download/, and you can download the jQuery UI source files from https://github.com/jquery/jquery-ui/releases (use the files in the ui directory). You can alternatively download these libraries using a package manager such as Bower.

I can see how it's possible to miss the download link and skip ahead.

@scottgonzalez
Copy link
Member

Do you think it's worth adding emphasis to the jQuery UI download link:

No, I think most AMD users will be using npm. This article was written when we didn't have ownership of the jquery-ui package on npm. At this point we do, but we only have 1.12.0 pre-releases published so far. Once there's a stable version on npm, I would expect the article to point to that instead of GitHub. We do currently link to Bower, but I would personally prefer for that to go away so that we continue to push the community to npm for all things JavaScript.

@Jondeen
Copy link

Jondeen commented May 4, 2017

It seems like things have changed since this document was written. Are there any instructions as to how to use Jquery-UI with requirejs as of 1.12.1?

I see the demos in the source are using an elaborate bootstrap.js to dynamically require any used modules (from what I can tell). Is this the recommended way?

SORTED:
This fails (as described on the instruction page):

require([ "jquery-ui/autocomplete" ], function( autocomplete ) {
    ...
});

This works:

require([ "jquery-ui/widgets/autocomplete" ], function( autocomplete ) {
    ...
});

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

No branches or pull requests

5 participants