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:
grunt-contrib-watch
to provide live-reloading when debugging.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
This template organizes content with the following structure:
www/assets
when the project is built.www
without any processing..po
files in this directory.Once grunt build
has been run, the www
directory will have the following structure.
assets
directory.config.json
file in the root.src/html
.The following configuration files are provided to ease into the workflow provided by this template.
.d.ts
files in the typings
directory.You can always use grunt -h
to list all available tasks. Below is a list of useful tasks provided by this template.
www
, then compiles and copies code and assets into the same directory.<ctrl>-C
on the command line to stop the task.serve
, but provides live reload for the served files. The watch
task is called to trigger the live reload. Press <ctrl>-C
on the command line to stop the task.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.