HTML template

0 favourites
  • 7 posts
From the Asset Store
Fruit Slicer Template & Quality fruit and slice graphics (c3p,png,illustrator files)
  • So I find myself editing the index.html file from my games after exporting them quite often.

    This is simple enough, but becomes a nuisance when copying all the files over from a new build later, knowing that it will overwrite any changes I made in the index.

    I can set up a special case where it will ignore the index when copying everything, but I just want to be sure that I will never need to replace that file with a new version or a new export.

    I was thinking it would be cool if within Construct2 there was an html template that more advanced developers could edit and would be used to create the final index.html upon export.

    Anybody else already have a solution they use for this?

    I searched the site and didn't come up with anything

  • helto

    It'd be helpful if you could explain why you find yourself editing the index.html quite often.

    What edits are you making?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Couldn't you set the attribute of the index.html file in your export folder to "read only" so that the consecutive exports don't overwrite it once you modified it first ?

    Also, like Velojet I'm wondering why are you in need of modifying frequently the index.html file ?

    In my tutorial about customizing the export HTML page 2 at the end of the page I point out a tip that looks like what you could be looking for.

    But it's a hacky method and it could put your project and C2 at risks. Be warned.

  • Velojet

    Kyatric

    There are several reasons:

    I have extra code that references the parent when loading games in an iframe.

    adding javascript functions

    passing/referencing dynamic data

  • I have extra code that references the parent when loading games in an iframe.

    adding javascript functions

    passing/referencing dynamic data

    Are those things stuff you use/need in your game ?

    If so, I guess you could use AJAX for passing/referencing and "parent" (?).

    As for adding JS functions, use those functions in a plugin you made.

    If those are irrelevant to the game itself, simply don't copy the index.html when copying your files to the destination site, rather using the HTML entry point file in there.

    It is still not clear to me what you're doing exactly and why you need editing of the file. It sounds even like you shouldn't be editing it at all.

  • helto

    Thanks for the clarification. Any tedious repetitive handwork like that is a prime candidate for automation. Go with Kyatric's advice about making a plugin. That'll also let you append to index.html:

    jQuery('head').append('[i][text to append]'[/i]);

    (Put it in the runtime onCreate() function.)

    Much better than a HTML template!

  • Kyatric

    Velojet

    Thanks guys, will do.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)