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

V4 . Will have to add a variable to JQuery version #102

Open
crochefort opened this issue Mar 10, 2014 · 3 comments
Open

V4 . Will have to add a variable to JQuery version #102

crochefort opened this issue Mar 10, 2014 · 3 comments

Comments

@crochefort
Copy link
Contributor

See those line

https://github.com/wet-boew/wet-boew-php/blob/v4.0/dist-php/inc/foot-nav.php#L47
and
https://github.com/wet-boew/wet-boew-php/blob/v4.0/dist-php/inc/head-css.php#L13

Where we have a version in the link we should change the hard coded version to setup a dynamic version.

So if they @wet-boew decide they update the theme and the JS ... we don't have to redownload everything... just change the version in the configuration file and we are good to go.

What are you throught on this @upsonp ?

@pjackson28 do you know if google have a link like http://code.jquery.com/jquery-latest.min.js ???

@nschonni
Copy link
Member

Latest isn't a good idea to use "latest" since you'd end up using versions of jQuery that WET might not support. It is also bad for caching reasons.

@upsonp
Copy link
Member

upsonp commented Mar 13, 2014

Being sick for a couple days really throws you out of the loop.

@nschonni I think what @crochefort is saying is for the PHP variant we should have a convenient variable that will allow us to update the jQuery version when the core project updates, not update the version whenever there's a new jQuery version available. If that's the case it probably wouldn't be a bad idea. I almost missed updating the jQuery version to what the Core project was using when I was updating the splash pages.

@michael-milette
Copy link
Contributor

I haven't looked at WET-BOEW-PHP v4 in a while so I'm not sure how relevant this will be. However are my 5 cents (sorry, no more 1 cents in Canada) in case it helps.

With regards to:

http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js

The code should not refer to jquery.min.js on a 3rd party site. This should be included for the reasons @nschonni mentioned plus you never want your site to break because of someone else's.

If you are moving it locally, the version number no longer matters, unless of course it conflicts with the version being used by the application it is integrated into as would be the case for WET-BOEW-PHP. For example, Moodle still uses jQuery 1.10 where as WET is using 2.1. Fortunately for me, I am able to turn jQuery off in Moodle and just use the WET version which I cannot turn off (at least in WET 3.1). So far I've been lucky in that Moodle seems to be able to live with the newer version without anything breaking. However if you could include a configuration switch to disable loading of jQuery for those applications where it is already loaded and can't be turned off in the application, that would be great.

If you include jQuery in WET, but want to put it in a numbered folder to identify the version, you could use a piece of code to dynamically and automatically detect the version number. For example:

// Retrieve the path to the currently installed version of jQuery UI
$jQueryUIPath = glob(realpath(dirname(__FILE__).'/../../..').'/lib/jquery-*', GLOB_ONLYDIR);
$jQueryUIPath = pathinfo($jQueryUIPath[0]);
$jQueryUIPath = '../lib/jquery/'.$jQueryUIPath['basename'];

What you end up with in the $jQueryPath variable is the name of the folder where jQuery is stored. Then you never have to update the version number even if it changes.

Hope this helps. Let me know if you have any questions.

Best regards,

Michael

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

4 participants