0

Add javascript libraries as package

asked 2017-12-15 14:19:21 +0800

JustinFrost gravatar image JustinFrost
139 1 6

updated 2017-12-15 14:23:00 +0800

I have created a series of custom components created as a maven project.

I have a series of javascript libraries that I want available to everything in this project. Currently I have them defined in the lang-addon.xml as follows:

<language-addon>
    <addon-name>com.test.ui.component</addon-name>

    <version>
        <version-class>com.test.ui.component.Version</version-class>
        <version-uid>1.0</version-uid>
        <zk-version>7.0.1</zk-version><!-- or later -->
    </version>
    <language-name>xul/html</language-name>
    <depends>zul</depends>

    <!-- 1. Path to javascript for macro components and shared javascript libraries -->
    <javascript src="~./test/ui/component/js/velocity.min.js"/>
    <javascript src="~./test/ui/component/js/velocity.ui.min.js"/>

</language-addon>

This is working, however to cater for caching issues (prevent users needing to refresh if a change is made to these libraries) I would like to define the external javascript libraries in their own package (WPD) like widgets.

According to the documentation this should be possible. I have defined the package zk.wpd file as follows:

<?xml version="1.0" encoding="UTF-8"?>
<package name="test.ui.js.libraries">
    <script src="velocity.min.js"/>
    <script src="velocity.ui.min.js"/>
</package>

Then in the lang-addon.xml I have define the javascript package and a version number:

<javascript-module name="test.ui.js.libraries" version="1.1.0"/>
<javascript package="test.ui.js.libraries"/>

Unfortunately the js libraries are not loading and I get a component not found error when I load the page.

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2017-12-15 14:19:21 +0800

Seen: 10 times

Last updated: Dec 15 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More