Skip to content
bendangelo edited this page May 24, 2012 · 5 revisions

Using the Config File

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.

What is YML?

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/*"
 }

Common Settings

  • canvas-id Defines the canvas id and in the variable re.canvas.

  • height Defines the canvas height.

  • width Defines the canvas width.

Script Settings

  • 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 Settings

  • build-scripts-ignore Same as scripts-ignore but only runs during entityjs 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 as entity-ignore but only runs during entityjs 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 the game.min.js

  • build-foot Same thing as build-head except to the end.

Example: Wrap game inside a self-executing anonymous function on build

 build-head: (function(){
 build-foot: })();

Var Settings

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.

Clone this wiki locally