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

Use custom jquery.js #897

Closed
dominicast opened this issue Dec 14, 2017 · 4 comments
Closed

Use custom jquery.js #897

dominicast opened this issue Dec 14, 2017 · 4 comments
Assignees
Milestone

Comments

@dominicast
Copy link

dominicast commented Dec 14, 2017

Hi there

I use Bootfaces version 1.1.3 and I try to provide a custom version of jquery as described here:

CSS files, JS files and CDNs

These are my first lines of my template:

	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:b="http://bootsfaces.net/ui" xmlns:p="http://primefaces.org/ui">

	<h:head>

	<title>Internet Domains</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta charset="utf-8" />

	<h:outputScript name="/reg/js/jquery-1.11.1.min.js" position="first" />

And this is what was finally generated:

	<!DOCTYPE html>
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><link type="text/css" rel="stylesheet" href="/reg/resources/theme.css?ln=primefaces-aristo" /><link rel="stylesheet" type="text/css" href="/reg/resources/css/other/core.css?ln=bsf" /><link rel="stylesheet" type="text/css" href="/reg/resources/css/bsf.css?ln=bsf" /><!--[if lt IE 9]><script src="/reg/resources/js/html5shiv.js?ln=bsf"></script><script src="/reg/resources/js/respond.js?ln=bsf"></script><![endif]--><script type="text/javascript" src="/reg/resources/jq/jquery.js?ln=bsf"></script><script type="text/javascript" src="/reg/resources/jsf.js?ln=javax.faces&amp;stage=Development"></script><script type="text/javascript" src="/reg/resources/js/alert.js?ln=bsf"></script><script type="text/javascript" src="/reg/resources/js/bsf.js?ln=bsf"></script><script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.projectStage='Development';}</script><meta name="viewport" content="width=device-width, initial-scale=1"/>

	<title>Internet Domains</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta charset="utf-8" />

	<script type="text/javascript" src="/reg/js/jquery-1.11.1.min.js"></script>

I expected that the <script type="text/javascript" src="/reg/resources/jq/jquery.js?ln=bsf"></script> will be replaced by <script type="text/javascript" src="/reg/js/jquery-1.11.1.min.js"></script>. This is how I understood the documentation. But it does not happen. I can avoid including the query.js?ln=bsf useing the web.xml parameter net.bootsfaces.get_jquery_from_cdn. But I need to load jquery before Bootfaces load alert.js and bsf.js. Can anyone help me to get this working?

Thank you! Dominic

@stephanrauh
Copy link
Collaborator

BootsFaces checks the beginning of the file name. You've put jquery in a subfolder, so BootsFaces doesn't detect it. Maybe we should correct this in BootsFaces 1.2.0.

@stephanrauh
Copy link
Collaborator

I've uploaded a new version of the BootsFaces-1.2.0-SNAPSHOT. See #369 on how to get it. Can you test if the bug is solved in the new version?

@TheCoder4eu
Copy link
Owner

@stephanrauh it is marked Done in the Project board, can I close this issue?

@stephanrauh
Copy link
Collaborator

stephanrauh commented Dec 26, 2017

@dominicast The bugfix work if you modify your h:outputScript. I'm not sure whether your version should work. I suspect it shouldn't, so current I leave it at that. Here's what you need to do:

  • add the library attribute. Otherwise, the resulting folder name contains a double // or \\. When I tried, this doesn't work. Maybe that's a peculiarity of OSX.
  • Add the attribute target="head". For some reason, BootsFaces only looks for jquery in the head section.

This is the statement that worked on my machine:

<h:outputScript library="reg" 
                name="js/jquery-1.11.1.min.js" 
                position="first" 
                target="head" />

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

No branches or pull requests

3 participants