fractile81 / cordova-phaser-ts-jed

Cordova template that provides Phaser Typescript support, plus Jed for i18n.
Apache License 2.0
35 stars 4 forks source link

Cordova Template for Phaser, using Typescript and Jed

A Cordova/PhoneGap template for building a Phaser game using Typescript. Both Jed and po2json have been included to assist in any internationalization (i18n) efforts.

The workflow provided by this template will assume control of the www directory. Any content added or changed in this directory manually will be overridden or removed by the provided Grunt tasks.

Features include:

Quickstart

To use this template with cordova, create a new Cordova project with the --template parameter.

cordova create <directory> <project-scope> <project-name> --template cordova-phaser-ts-jed 

NOTE: <project-scope> should resemble com.example.<directory>, although the decision is ultimately yours.

Once the project has been created, run the following:

npm install

After installation, all packages should be ready to use in the <directory> indicated. You should update the generic package.json and src/html/index.html files to with the name and version of the project, as applicable.

To initially populate the www directory, or update the www directory with any changes, use the following command:

grunt build

Top start a server for the project, use the command:

grunt serve

This will start a server at http://localhost:9000 on your computer. You can open this page in your default browser by changing the command to grunt open serve.

While being served, you can use F5 (or <cmd>-R) to reload the page in the browser. Use <ctrl>-C on the command line to stop the server.

Or, if you plan to actively develop your project and need live reload, use the command:

grunt debug

This will copy any asset or static file changes immediately, as well as recompile any changed TypeScript files. The task will automatically reload the page opened in your browser once the changes propagate into the www directory.

The page served by this task can also be manually reloaded in the browser, or aborted on the command line.

If you only want to update code changes without a server, you can use the command:

grunt watch

Project Structure

This template organizes content with the following structure:

Once grunt build has been run, the www directory will have the following structure.

The following configuration files are provided to ease into the workflow provided by this template.

Grunt Tasks

You can always use grunt -h to list all available tasks. Below is a list of useful tasks provided by this template.

License

Copyright 2017 Craig A. Hancock

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.