Giter Club home page Giter Club logo

cordova-phaser-webpack-typescript's Introduction

Cordova - Phaser - webpack - TypeScript skeleton

-- still under development.

A starting skeleton that combines all these frameworks for easy development. Either fork the repository or follow the manual steps below to create it.

Cordova - Mobile apps with HTML, CSS & JS. Target multiple platforms with one code base

Phaser - Desktop and Mobile HTML5 game framework. A fast, free and fun open source framework for Canvas and WebGL powered browser games.

webpack - webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging

TypeScript - TypeScript is Typed JavaScript at Any Scale. TypeScript extends JavaScript by adding types to the language.

Run

npm install -g [email protected] [email protected] [email protected]
npm install
npm run dev-browser

Manual configuration

Install packages and configure cordova

In your working folder, if we want to make generate a new game folder by cordova

cordova create game
cd game
cordova platform add browser

All below commands can all be executed from our current working folder path game

Lets add our package.json dependencies and devDependencies

Let's check if everything is working so far

cordova run browser 

Use cordova with webpack

Install cordova-plugin-webpack

cordova plugin add [email protected]

Make modifications to your previous default cordova installation.

mkdir src
mv www/js/index.js src/index.js

Use the contents of this default webpack.config.js and put it in your game folder as file webpack.config.js.

Replace scripts in the index.html file in the www folder. vendors.app.bundle.js will not be created yet but we will later.

<script src="vendors.app.bundle.js"></script>
<script src="app.bundle.js"></script>

In package.json add the following line to the scripts object:

"dev-browser": "cordova prepare browser -- --livereload && cordova build browser -- --webpack.config.js && cordova run browser -- --livereload --webpack.config.js",

Let's test if cordova is working with webpack

npm run dev-browser

Add typescript to webpack

In your src folder, delete index.js. Create the following structure: `

add a typscript configuration file tsconfig.json in the game root folder with the following contents

edit your existing webpack.config.js and use the following contents

Let's run everything together

npm run dev-browser

cordova-phaser-webpack-typescript's People

Contributors

jvanderbiest avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.