Monaca Onsen UI Discord Chat Github Repo

Newbie Getting Started Question

  • I’m new to both Cordova and OnSen so forgive my ignorance.

    Two add OnSen to a Cordova project the getting started quide cites two approaches:

    • You can add the css/js files via a CDN. I can do this and it works, assuming I remove the default Content-Security-Policy but I’d rather not do this.

    • The second approach cited is to install using node. I’ve done this and I can see the folder in my node_modules folder but the guide just stops there and doesn’t give any suggestions on how to include in your project.

    I do have an Angular background and for an Angular project I would just import the resources but what about a simple HTML/CSS application?

    • Is there a better way to add them to my project other that to just copy/paste into my local js/css folders?

    • Being new to Cordova as well, is it a bad idea to just relatively reference the node_modules folder? Ie will they get built properly?

  • administrators

    The simplest way is either:

    1. Use a CDN.
    2. Download the files from the CDN manually and put them in your source director.

    Or if you want to use npm you will need to use a bundler such as rollup.

    This is an example to show how to use OnsenUI with a local copy:

  • Thanks, I wasn’t sure if there was an easier way but this makes sense.

    I can play with a bundler for a more elegant solution later but per the example I just made a /lib folder and dropped everything in there.