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
PrimeFaces, BootsFaces and JQuery: resource ordering #640
Comments
P.S.: When I drop BootsFaces I don't have this problem. |
In the ResourceFileComparator the JS files will be renamed like if (name.contains("jquery-ui"))
name = "2.js"; // make it the second JS file
else if (name.contains("jquery"))
name = "1.js"; // make it the first JS file But in my case the name for jquery-ui is: "jquery/jquery-plugins.js" |
Now this code works for me: private String renameJSFile(String name) {
name = name.toLowerCase();
if (name.contains("jquery.js"))
name = "1.js"; // make it the first JS file
else if (name.contains("jquery"))
name = "2.js"; // make it the second JS file
else if (name.contains("ui/core.js"))
name = "3.js"; // make it the third JS file
else if (name.contains("ui/widget.js"))
name = "4.js"; // make it the second last JS file
else if (name.contains("bsf.js"))
name = "zzz.js"; // make it the last JS file
else
name = "keep.js"; // don't move it
return name;
} |
Closed by mistake, sorry. |
I've taken a slightly different approach that should be a bit more flexible. If you jquery-plugins.js depends on jquery-ui, please rename it to jquery-ui-plugins. Hope that works for you! if (libname.contains("jquery-ui"))
name = "2" + libname; // make it the second JS file, while still distinguishing between jquery-ui.js and jquery-ui-plugins.js
else if (libname.contains("jquery")) {
name = "1" + libname; // make it the first JS file, while still distinguishing between jquery.js and jquery-plugins.js
}
else if (name.contains("ui/core.js"))
name = "3.js"; // make it the third JS file
else if (name.contains("ui/widget.js"))
name = "4.js"; // make it the second last JS file
else if (name.contains("bsf.js"))
name = "zzz.js"; // make it the last JS file
else
name = "keep.js"; // don't move it |
Hello I need Help please, i have the same problem but i don't understand the solution. |
@mamar93 You don't have to do anything, that's our job! :) The code snippet stems from an internal BootsFaces class (AddResourcesListener). I gather you ran into a problem, so I'd like to invite you to debug this class. Admittedly, it's the most complicated class of BootsFaces, but I believe it's possible to understand what's happening there. At least I hope so. |
Hey there,
I have a "HelloWorld" page which uses a PrimeFaces component and some BootsFaces tags for layout.
On the first load the page is ok, no error in console etc.
When I hit a simple h:commandLink in the JS console appears:
Uncaught ReferenceError: jQuery is not defined at tbmDisposition-aendernPF.jsf:3 VM219 jquery-plugins.js.jsf?ln=primefaces&v=6.0:5 Uncaught ReferenceError: jQuery is not defined at VM219 jquery-plugins.js.jsf?ln=primefaces&v=6.0:5 at VM219 jquery-plugins.js.jsf?ln=primefaces&v=6.0:5
The reason is that jquery-plugins is loaded before jquery.
My question is:
Which class is finally responsible for the ordering and is there a chance to influence or reimplement this?
Some version informations:
PrimeFacs: 6.0
JSF: 1.2_15-jbossorg-2 (= JSF 2.1
Server: jboss-as-7.1.2.Final
BootsFaces: 1.0.2
Mojarra 2.1.19
See also: http://stackoverflow.com/questions/42390734/primefaces-and-jquery-resource-ordering
The text was updated successfully, but these errors were encountered: