+1 for both solutions, we could use a maven based approach for
embedding resources without duplication and Rupert's proposal for
constraining js libraries in html pages.

I summarize here (integrate if you like):
- default shared js are inserted only if they affect the container layout
- additional js libraries can be shared (for example from a commons.js
bundle), but inserted on demand by fragments
- the common bundle can collect libraries using a maven based
approach, form internal/external artifacts
- web fragments should be able to remove/overwrite a js library,
without affecting other web fragments
- the list of appended js should be respected (fifo)

If we agree on this, I can open an issue (but I don't have time to
work on this immediately, if someone else wants to start it's welcome)

Bests
Enrico

On 18 November 2011 10:01, Reto Bachmann-Gmür <[email protected]> wrote:
> On Thu, Nov 17, 2011 at 11:57 AM, Enrico Daga <[email protected]> wrote:
>
>> Hi,
>> it seems to me that a similar discussion have been already taken in
>> the list, but I can't find it.
>>
>> My problem is related to STANBOL-378, which started as a problem with
>> a disappeared function but know it looks to me a more generic issue.
>>
>> I have deployed the integrity-check demo within a full launcher +
>> reasoners, and the demo - which worked since some time ago - raised
>> problems with javascript.
>>
>> I see now a lot of javascript libs embedded in the page, some of them
>> are duplications of the same library, in one case they are the same
>> library but with different version.
>>
>> Here is the list in my web page:
>>
>> /static/home/scripts/jquery-1.4.2.js
>> /static/contenthub/scripts/prettify/prettify.js
>> /static/contenthub/scripts/jit.js
>> /static/contenthub/scripts/jquery-1.5.1.min.js
>> /static/contenthub/scripts/jquery-ui-1.8.11.custom.min.js
>> /static/factstore/scripts/json2.js
>> /static/enhancer/openlayers-2.9/OpenLayers.js
>> /static/ontonet/actions/actions.js
>> /static/rules/actions/actions.js
>> /static/rules/actions/tutorial.js
>> /static/enhancervie/lib/jquery-1.5.1.js
>> /static/enhancervie/lib/jquery-ui.1.9m5.js
>> /static/enhancervie/lib/underscore-min.js
>> /static/enhancervie/lib/backbone.js
>> /static/enhancervie/lib/jquery.rdfquery.debug.js
>> /static/enhancervie/lib/vie/vie-latest.debug.js
>> /static/enhancervie/lib/hallo/hallo.js
>> /static/enhancervie/lib/hallo/format.js
>> /static/enhancervie/lib/annotate.js
>> /static/integritycheck/jquery.rdfquery.core-1.0.js
>> /static/integritycheck/jquery.cookie.js
>> /static/enhancer/scripts/prettify/prettify.js
>> /static/integritycheck/integritycheck.js
>>
>> The problem here is that the loading order is **out of control**,
>> because is demanded to the JAX-RS resource initialization.
>> If I restart bundle , for example, and reload the page, I see some
>> differences:
>>
>> /static/home/scripts/jquery-1.4.2.js
>> /static/contenthub/scripts/prettify/prettify.js
>> /static/contenthub/scripts/jit.js
>> /static/contenthub/scripts/jquery-1.5.1.min.js
>> /static/contenthub/scripts/jquery-ui-1.8.11.custom.min.js
>> /static/factstore/scripts/json2.js
>> /static/enhancer/openlayers-2.9/OpenLayers.js
>> /static/ontonet/actions/actions.js
>> /static/rules/actions/actions.js
>> /static/rules/actions/tutorial.js
>> /static/integritycheck/jquery.rdfquery.core-1.0.js
>> /static/integritycheck/jquery.cookie.js
>> /static/enhancervie/lib/jquery-1.5.1.js
>> /static/enhancervie/lib/jquery-ui.1.9m5.js
>> /static/enhancervie/lib/underscore-min.js
>> /static/enhancervie/lib/backbone.js
>> /static/enhancervie/lib/jquery.rdfquery.debug.js
>> /static/enhancervie/lib/vie/vie-latest.debug.js
>> /static/enhancervie/lib/hallo/hallo.js
>> /static/enhancervie/lib/hallo/format.js
>> /static/enhancervie/lib/annotate.js
>> /static/enhancer/scripts/prettify/prettify.js
>> /static/integritycheck/integritycheck.js
>>
>> I don't know if this order is deterministic or not, but I am sure that
>> this makes the whole Stanbol UI potentially unstable.
>>
>> As immediate workaround I suggest to **do not** share js libraries
>> between different JAX-RS resources, and maybe create a /static/commons
>> path where to put shared js code (but not embedding it automatically)
>>
>> Any other idea?
>>
> I suggest to deploy the maven resources bundle approach as I've implemented
> this for annotate.js and vie for more js project.
>
> For an example on how annotate.js is integrated in a project without having
> the js in the project source folder see:
> https://github.com/retobg/sling-stanbol/blob/master/sling-stanbol-ui/pom.xml
>
> I'm not sure what a good home for mavenized js projects would be, it should
> allow easy publication to the maven central repo. Maybe ops4j/pax?
>
> Cheers,
> reto
>
>
>>
>> Enrico
>>
>> --
>> Enrico Daga
>>
>> --
>> http://www.enridaga.net
>> skype: enri-pan
>>
>



-- 
Enrico Daga

--
http://www.enridaga.net
skype: enri-pan

Reply via email to