-
Notifications
You must be signed in to change notification settings - Fork 24
Config
This page explains all the commands and uses for the config.yml in the root directory of EntityJS games.
The config file lets you configure the interactions between the EntityJS gem and your game. This includes stuff like, script ordering, ignoring scripts, build settings and more. Currently the config file makes no changes to javascript code.
YML is a simple text structure often used for configuration of applications. Its just like JSON but very simple, here is an example both in JSON and YML.
canvas-id: game-canvas
width: 500
height: 300
order:
base.js
tile.js
entity-ignore:
util/*
scripts-ignore:
gun.js
items/*`
Is the same as this in JSON:
{
"canvas-id":"game-canvas",
"width":500,
"height":300,
"order":"base.js tile.js",
"entity-ignore":"util/*"
}
-
canvas-id
Defines the canvas id and in the variablere.canvas
. -
height
Defines the canvas height. -
width
Defines the canvas width.
-
scripts-ignore
Will ignore scripts with similar names. Regex accepted. -
entity-ignore
Will ignore entityjs scripts with similar names. Regex accepted. -
order
Orders files to be included before other scripts. Entityjs scripts are always included first. Regex accepted.
-
build-scripts-ignore
Same asscripts-ignore
but only runs duringentityjs build
command. This is useful if you're using plugins like JQuery and you don't want it to be included in the minified game.
Example: Ignore all scripts in the plugins folder
build-scripts-ignore: plugins/*
-
build-entity-ignore
Same asentity-ignore
but only runs duringentityjs build
command. This is useful if you don't want to compile all entityjs source with the game.
Example: Ignore all Entityjs scripts
build-entity-ignore: .*
-
build-head
Appends whatever entered to the beginning of thegame.min.js
-
build-foot
Same thing asbuild-head
except to the end.
Example: Wrap game inside a self-executing anonymous function on build
build-head: (function(){
build-foot: })();
In the future all settings in the config.yml file will be available in JS and HTML precompiling. Similar to #define
in C++.
For example defining base-attack: 1.1
will replace all text of RE_BASE_ATTACK
with "1.1" inside HTML and JS files.
Currently only RE_CANVAS_ID
, RE_HEIGHT
, RE_WIDTH
and RE_VERSION
are available in some cases.