A Yeoman Generator for creating a Cordova Application Skeleton which runs in the Ripple Emulator
This generator creates a skeleton Cordova project for you to build upon afterwards. It does the following:
- Starts the Ripple Emulator in a browser and will begin watching your CSS and JS, and rebuild every time you save a change. It will auto refresh the ripple emulator's viewport too.
- Adds a cordova "browser" platform for you to test your mobile apps in a web browser. It does not replace development on an actual device for testing or debugging. Nothing replaces that.
- Dynamically wires javascript dependencies to your index.html file when adding javascript libraries through bower.
- Creates a Cordova friendly project
Install these if you do not have them
- Node.JS
- Ruby
- Python 2.7
If you're not sure if they're installed, run these commands from the command line/terminal:
node -v
ruby -v
python --version
These commands should be available globally in the command line/terminal.
- Compass:
gem install compass
- Grunt:
npm install -g grunt-cli
- Bower:
npm install -g bower
- Yeoman:
npm install -g yo
- Cordova:
npm install -g cordova
- Ripple Emulator:
npm install -g ripple-emulator
For various platform environments such as Android and iOS, you'll want to install the respective SDKs and Cordova Platform Plugins. For more info, see https://cordova.apache.org/docs/en/4.0.0/guide_platforms_index.md.html#Platform%20Guides
- Install the generator:
npm install -g generator-cordova-ripple
- Create a working directory and navigate into it:
mkdir my-cordova-ripple-project
cd my-cordova-ripple-project
- Run the generator to generate project files:
yo cordova-ripple
Make sure you are in the root of your working directory and run the following from the command line:
grunt
To install javascript libraries you'd like to use in your project, you can use bower. i.e.:
bower install jquery --save
This will install your library and update your index.html file to reflect the new library reference
- All developments for your project should be contained within the "www" folder, which is created after running this generator.
- Sass development for this generator has been configured to reference the .scss file located at
www/styles/main.scss
.- When you update this file, another file,
main.css
will be created/updated, which is currently referenced by the application. - To reference sass files from with in the
main.scss
, do so by doing the following:- create another scss file prefixed with an underscore (i.e. _reference.scss). The underscore tells compass to ignore that file when processing.
- add an import statement in
main.scss
, i.e.@import "reference"
, without the underscore and without the extension. - when your sass files are compiled, you should see the file
main.css
updated to reflect all changes betweenmain.scss
and imported sass files.
- When you update this file, another file,
- When running your generated application for other platforms (i.e. android, iOS), besides the 'browser' platform, make sure to run the following to update the files for the platform you wish to run against:
grunt build
- Additional Notes
- Before running the above, the assumption here is that you have already added a platform to your project i.e.
cordova platform add ios
. - If you're not running the server, and you want to update a platform, you can still run the above command
grunt build
.
- Before running the above, the assumption here is that you have already added a platform to your project i.e.
- Cordova Documentation: https://cordova.apache.org/docs/en/4.0.0/index.html