JS/CSS Components

JS/CSS components are JavaScript and CSS libraries you may need to include to your project such as jQuery, jQuery mobile, Onsen UI and so on.

In order to add a JavaScript/CSS library, please do as follows:

  1. From Monaca Cloud IDE, go to Configure → JS/CSS Component Settings.

  2. Then, JS/CSS Components page will be shown. You can see several libraries listed there. If you can’t find the library you want, input the library’s name in a search box to find it.

  3. Assuming you are searching for Angular, a list of matched libraries will be shown after clicking on Search button.

  4. Click on Add button to include the library you prefer. Then, you can choose which version of the library to include in your project.

  5. Next, select which files of the library you want to include and click Save.

  6. After that, you will find your newly added library in the list. Click on Configure button when you want to change the library’s version and selected file(s).

When a library is added, its files are added into www/components folder. The following JavaScript and CSS files will also be automatically updated. These files will always be presented regardless of which libraries are added into your project.

File Name Description
loader.js A JavaScript file used by Monaca to load JavaScript libraries
loader.css A style sheet file used by Monaca to load CSS libraries

Therefore, libraries can be loaded by simply referencing the two files (as shown above) in the HMTL file. More specifically, all you need to do is include the following descriptors within the <head> tag of the HTML file.

<script src="components/loader.js"></script>
<link rel="stylesheet" href="components/loader.css">
loader.js file also loads cordova.js file.
If you would like to use images within your libraries, you can directly load those image files from the components folder.