This is a repo used to develop web based games using webpack + react + redux. It is mostly meant as a sandbox to gain experience with these technologies, but hopefully the games will be fun too!
-
Clone this repo using
git clone [email protected]:Josh211ua/mini-games
-
Run
npm install
to install the dependencies. -
Run
npm start
to start the local web server. -
Go to
http://localhost:3000
and you should see the app running!
Currently tests and lint are not being automatically run on the repository, so make sure they pass before checking in new code. The available commands are:
$ npm run lint
Checks your JavaScript coding styles for potential errors and suspicious usage of included functions.
$ npm run test
Lints JavaScript files and tests your application with the unit tests specified in the test
folder.
$ npm run test:watch
Runs unit tests everytime you change something in your JavaScript code
Currently things are set up to run a server on the development machine.
-
Run
npm run build
, which will compile all the necessary files in abuild
folder. -
Run
npm run serve
which will create a serve files from that build folder. -
Go to
http://10.0.0.107:3000/
or whichever url the server suggests.
TODO
These are some things to be aware of when using this boilerplate.
Adding images to the HTML is a bit of a pain right now as webpack only goes through the JavaScript file. Add the image to your HTML file how you always would:
<!-- Normal Image -->
<img src="img/yourimg.png" />
<!-- Meta tags -->
<meta property="og:image" content="img/yourimg.png" />
<!-- ... -->
If you simply do this, webpack will not transfer the images to the build folder. To get webpack to transfer them, you have to import them with the file loader in your JavaScript somewhere, e.g.:
import 'file?name=[name].[ext]!../img/yourimg.png';
Then webpack will correctly transfer the image to the build folder.
While this is open source, its not really working towards anything so there is no reason to contribute. If you like to ask questions or give suggestions on best-practices, feel free to add an issue.