Index.html template

Hi,
when targeting HTML5 I’d like to have a personalized version of the index.html needed to launch the application, by adding a few metas and maybe something else: is it possible to modify a template somewhere? There is an index.html in lime/templates/html5/template folder, but even if I modify it I can’t see any variation in the compiled project, as if the template folder was ignored.

You can overwrite any template file with your own version by using the template tag in your project xml file. See here: http://www.openfl.org/learn/resources/command-line-tools/project-files/xml-format/

If you do it this way you won’t affect the default templates.

1 Like

Create a file at “templates/html5/template/index.html”

Add this to your project:

<template path="templates" />

Anything in that “template” folder will copy to your output folder for HTML5, so you can customize it at will :slight_smile:

1 Like

@bubba_169 @singmajesty
Great! Thank you guys!

While you can have stuff live in the actual templates folder, you can also do it this way (which is how I handle it).

<template path="assets/data/index.html" rename="index.html" />
1 Like

I recently created an example project that demonstrates how to customize the index.html template in an OpenFL project:

3 Likes