Details
-
Improvement
-
Resolution: Fixed
-
Major
-
6.3-milestone-2
-
None
Description
Right now if you want to use a resource from a WebJar you need to do something like this:
$services.webjars.url('angularjs/1.2.11/angular.js')
The WebJar version is hard-coded so whenever you update the dependency version in your POM file you need to remember to update your source files. Putting the version in the source files is a bad practice anyway.
The WebJar version can be determined using the Extension Manager so it shouldn't be mandatory to specify it. You may still want to be able to specify the version if you have multiple applications using different major versions of the same WebJar but the version should be optional.
I propose this API:
$services.webjars.url('angularjs', 'angular.js') $services.webjars.url('org.xwiki.platform:xwiki-platform-tree-webjar', 'tree.js')
You just have to specify the WebJar id (which is groupId:artifactId but you can omit the groupId if it is 'org.webjars') and the resource path (starting from the version folder).
I think we also need a way to pass parameters to a WebJar resource so this should work too:
$services.webjars.url('angularjs', 'angular.js', {'version': '1.2.11'})
We should of course keep the old API for backwards compatibility.
Attachments
Issue Links
- blocks
-
XWIKI-11372 Add support for evaluating WebJar resources that contain Velocity code
- Closed
-
XWIKI-11176 Use jsTree to rewrite and improve the trees we currently have in XWiki
- Closed
- relates to
-
XWIKI-20236 Webjars resolution does not take into account xwiki.extension.features
- Closed