Game Development Reference
In-Depth Information
}
}
The name of the object, “connect,” is how we will reference this task later on when we run it.
Each task takes a set of options; in this case we are configuring a server with port 8080 and a
base directory to serve as the root of the project. Now all we need is to set up a simple open
task.
open: {
dev: {
path: 'http://localhost:8080/index.html'
}
}
This will allow us to open up our computer's default browser and point it to our localhost.
The last thing we need to do is create some tasks to run this. In order to do this we simply re-
gister a task with Grunt.
grunt.registerTask('default', ['connect', 'open']);
Now that we have gone over how the task works you simply CD into the directory with the
GruntFile.js and call grunt.
> grunt
With everything properly configured to your own project structure, you should see your
browser open up when you run the Grunt build. Now you can continue to do your testing in
your browser with Node.js running and make changes to your code in Visual Studio.
Project Structure
We have already gone over how a Windows 8 HTML5 project is structured in Visual Studio,
so hopefully this will look familiar to you. You may recall that VS creates a default.html
file to host your project. This will actually work to our advantage since you are probably
used to using an index.html file to run your game from. The good news is that we can keep
both in our project and they will not affect each other. When we want to deploy our game to
Search WWH ::




Custom Search