Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including gulp-cordova-create with all npm packages installed. Try it out:

var gulpCordovaCreate = require("gulp-cordova-create")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gulp-cordova-create v2.0.1

Create a cordova project

gulp-cordova-create

Create a cordova project

Installation

npm install --save-dev gulp-cordova-create

Usage

const create = require('gulp-cordova-create');

gulp.task('build', () => {
    return gulp.src('www')
        .pipe(create());
});

This will generate a Cordova project in the .cordova directory. It will copy the contents of the www directory to the root directory of the Cordova project.

Make sure you html files are located in a directory called www.

Options

You can pass in extra options to change the initial configuration of the project.

const create = require('gulp-cordova-create');

gulp.task('build', () => {
    const options = {
        dir: 'myproject',
        id: 'com.myproject.hello',
        name: 'MyProject'
    };

    return gulp.src('www')
        .pipe(create(options));
});

This will execute the following command

$ cordova create myproject com.myproject.hello MyProject

And then it will copy the content of the www directory to the www directory of the cordova project.

API

create([options])

options

dir

Type: string
Default: .cordova

The name of the output directory.

id

Type: string
Default: io.cordova.hellocordova

The reverse domain-style identifier of the project.

name

Type: string
Default: HelloCordova

The application's display title.

Related

See gulp-cordova for the full list of available packages.

License

MIT © Sam Verschueren

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free