Failure to supress jsf.js after combining JS files #35

Closed
smasala opened this Issue May 27, 2014 · 8 comments

Projects

None yet

2 participants

@smasala
smasala commented May 27, 2014

When using Omnifaces CombineResourceManager and setting the myFaces JSF script target to head

    <h:outputScript library="javax.faces" name="jsf.js" target="head" />

Omnifaces catches and combines the script correctly, however, the jsf.js script tag is then inserted a second time at the end of the body.

    <script type="text/javascript" src="/xxxxx/javax.faces.resource/jsf.js.faces?ln=javax.faces"><!--

    //--></script>

By removing the target - Omnifaces no longer combines the JS script and the jsf.js file is only inserted once.

Is this a Omnifaces or myFaces issue?

Setup:
Tomcat 7.0.50
Richfaces 4.3.1
MyFaces 2.1.12
JSF 2.0

@BalusC
Member
BalusC commented May 27, 2014

Roger. Reproduced and fixed. Try the current 1.8 snapshot and let me know.
https://oss.sonatype.org/content/repositories/snapshots/org/omnifaces/omnifaces/1.8-SNAPSHOT/

@smasala
smasala commented May 28, 2014

Fantastic, it works! thanks

@smasala smasala closed this May 28, 2014
@BalusC BalusC added a commit that referenced this issue May 30, 2014
@BalusC BalusC Revert "#35 suppress MyFaces re-rendering of resource"
This reverts commit c7855e8.
7e3b92d
@BalusC
Member
BalusC commented May 30, 2014

Sorry, it broke including "hardcoded" JS resources (on among others zeef.com). I will re-investigate this issue later.

@BalusC BalusC reopened this May 30, 2014
@smasala
smasala commented May 30, 2014

With the snapshot you provided: The following CSS files are not suppressed:

<h:outputStylesheet library="oam.custom.calendar.WH" name="theme.css" />
<h:outputStylesheet library="oam.custom.calendar.DB" name="theme.css" />

And also the auto inserted JS resource:

<script type="text/javascript" src="/xxxxx/javax.faces.resource/inputTextHelp.js.xhtml?ln=oam.custom.inputTextHelp">
@BalusC
Member
BalusC commented May 30, 2014

I committed a fix, also for CSS. Can you please try today's snapshot? https://oss.sonatype.org/content/repositories/snapshots/org/omnifaces/omnifaces/1.8-SNAPSHOT/

@smasala
smasala commented Jun 2, 2014

CSS files are all combined. Great, thanks!

However, the inputTextHelp files from myfaces is still auto inserted for some reason. What's also strange is that it isn't combined either. Usually both happen when something goes wrong, they are combined and inserted a second time... however, this isn't the case this time.

<script type="text/javascript" src="/xxxxx/javax.faces.resource/inputTextHelp.js.xhtml?ln=oam.custom.inputTextHelp"><!--
//--></script>
@BalusC
Member
BalusC commented Jun 2, 2014

That may happen if the resource isn't added as a true JSF resource via @ResourceDependency annotation or UIViewRoot#addComponentResource() programmatic call, but is instead "hardcoded" in the renderer. In such case there's nothing what the CombinedResourceHandler can do. Basically, Tomahawk guys need to rewrite their components conform JSF 2.x instead of sticking to old JSF 1.x approach.

@smasala
smasala commented Jun 2, 2014

Typical 👍 Other than that it works like a dream :) Thanks

@smasala smasala closed this Jun 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment