How to add third party assets (JavaScript plugins) to the template?

1. Make sure you are in development mode. At the end of your HTML file should be included "js/script.js" instead of "js/script.min.js".

2. Copy your plugin to the "js/lib/myPlugin.js" folder.

3. Open the "js/script.js" file.

4. Add your plugin like shown in the screenshot.

5. If your plugin have some dependencies (like jQuery for example), write them in the shim config, like shown in the screenshot.

6. Open the "js/components/basicBind.js" file and add your plugin as a dependency like shown in the screenshot.

7. In the same file, in the "init" function, initialize your plugin, like shown in the screenshot.

8. If your plugin has some CSS dependencies, add them as usual in the <head> of your HTML page.

9. For more information on how to use the "Require.js" module loader, plese visit its official documentation.

Last update:
2016-05-25 13:19
Vlad Sargu
Average rating:0 (0 Votes)