From version < 2.2 >
edited by Vincent Massol
on 2019/09/13
To version < 2.1 >
edited by Camelia Andrei
on 2019/09/10
< >
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +XWiki.candrei
FAQCode.FAQClass[0]
answer
... ... @@ -10,3 +10,8 @@
10 10  Here are some examples:
11 11  * How to integrate React and XWiki: http://www.jria.xwiki.org/xwiki/bin/view/FAQ/How%20to%20integrate%20React%20and%20XWiki
12 12  * How to integrate Webpack and XWiki: http://www.jria.xwiki.org/xwiki/bin/view/FAQ/How%20to%20integrate%20Webpack.js%20and%20XWiki
13 +
14 +
15 +{{info}}
16 + Thanks to [[xwiki:XWiki.mflorea]] for contributing this faq.
17 +{{/info}}

You can integrate any JavaScript library / component in XWiki. There are multiple ways to do this, see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/FrontendResources/IntegratingJavaScriptLibraries/ . The recommended way is to:

  • install the third party JavaScript as a WebJar using XWiki's Extension Manager
  • load the JavaScript using RequireJS

If there's no WebJar package available for the JavaScript library you want to integrate then you can load it from a CDN (such as https://cdnjs.com/ or https://www.jsdelivr.com) or from the file system (by putting the JavaScript code inside XWiki's unpacked WAR).

RequireJS implements the AMD (Asynchronous Module Definition) API so the easiest for XWiki is to integrate JavaScript libraries that support AMD. This is the case for instance with React (https://reactjs.org/).

Here are some examples:

 Thanks to mflorea for contributing this faq. 

Get Connected