A toolset for generating Cordova (PhoneGap) apps that work with the Enyo app development framework.
Apache Cordova is the engine behind Adobe PhoneGap - it enables you to create native mobile applications using HTML, CSS, and JavaScript.
Enyo is an open-source, component-based JavaScript framework for building mobile or web-based apps.
cordova-enyo is an integration of Cordova's command-line interface (CLI) and Enyo's Bootplate template app, making it easy to jumpstart a Cordova-enabled Enyo app.
- git
- cordova-cli: The README provides a good overview of the installation procedure. A more detailed description, including information on how to set up all the platform-specific toolsets you might need is available here
cordova-enyo has been tested on Mac OS X, using the iOS and Android SDKs.
git clone [email protected]:linkmediainc/cordova-enyo.git
cd cordova-enyo
./bin/ce-create ./MyApp com.mydomain.myapp MyApp
cd MyApp
cordova platform add ios
cordova build
cordova emulate
NOTE: To continue developing, edit the CSS and JavaScript files in the MyApp/enyo/source
directory, rather than the www
directory - this follows the conventions for Enyo development and is different than most Cordova apps. For more details, see "Developing Your App" below.
ce-create
is the script that generates the Cordova-enabled Enyo application. To run it, make sure cordova-enyo/bin
is in your $PATH
, or else just specify the path (per the Quick Start example above).
ce-create
takes the exact same arguments as the cordova create
command; in fact, the arguments are passed in directly.
ce-create <directory> [<id> [<name>]]
If you omit the id
and name
arguments, the create command will generate workable defaults based on the directory name.
ce-create
runs cordova create
to generate the new application, then fetches the latest version of the Enyo bootplate template and places it into the enyo
directory at the top of your new app directory.
Once ce-create
has been successfully run, you will use the standard cordova-cli
commands to build and run your app, as well as to manage which platforms you want to build for. The cordova-cli page provides documentation for these commands.
IMPORTANT NOTE: Unlike most Cordova apps, you will do most of your development in the enyo/source
directory. If you've done Cordova or PhoneGap development before, you're probably used to working in the www
directory. This difference is due to the way that Enyo apps are built.
Enyo's bootplate template is set up to minify all of the JavaScript assets before deployment - this is a useful step as Enyo is a fairly large project, and the minification step keeps the package size small and speeds up the app's startup time. cordova-enyo
takes advantages of hooks in the cordova-cli
build commands, so that Enyo's build commands are run whenever cordova build
is invoked. The output of the Enyo build process is then transferred to the www
directory where it's picked up by Cordova's build command and transferred to the platform-specific build directory.
As a general rule, Cordova apps that rely on native APIs can't actually be run in the browser; but, if you're creating a simple app that doesn't use the native APIs, or if you're in the mockup phase and just want to do some quick tweaking/debugging, using a browser can be very handy: refreshing the page is a lot faster than relaunching the emulators, and you have access to all of browser-based developer tools.
To run your app in the browser, just open enyo/index-browser.html
. This is a slightly altered version of the standard index.html
with some key differences:
- the native Cordova APIs are not available - any code you have that relies on these will not run
- the page explicitly calls
deviceReady
on the app object after it's been created - the page uses the non-minified versions of Enyo and your own app code - this can help with debugging
- Enyo Home - includes documentation and tutorials
- Apache Cordova Home
- How PhoneGap Relates To Cordova - a guide for the confused