Index html and main.js

Hi, if I I want to use my own modified index.html or main.js what should I do? I create one and put in the project dir but it doesnt affect to the project when I run. Are they always generating during the build?

http://www.cocos2d-x.org/docs/creator/en/publish/custom-project-build-template.html

Thanks man, I am a bit ashamed of that we have it in docs and I asked this question :slight_smile:

Hi, I noticed that I have to create a build to start using my index.html with that build-template. Is there a way to modify the index.html in play mode?

You can access and manipulate the DOM from anywhere in code if that’s what you want.

Actually I would prefer to have my index.html in play mode. Is there a way to overwrite the default one?

You can find in default templates folder of Cocos Creator:

[Windows] C:\CocosCreator\resources\static

For play mode:

[Windows] C:\CocosCreator\resources\static\preview-templates
[Windows] C:\CocosCreator\resources\static\preview-templates\index.jade (index.html)
1 Like

It would actually be pretty awesome if we could define our own template per project for the editor live build. Or if the editor would just use the build template the same way an actual build game would.

3 Likes

And what do you think, shall we have that feature in close future? Or we should go ahead with this not straightforward workaround with changing the default in static folder?

That you would probably have to ask the Cocos team about.

This would be awesome and make so much sense to have, in my opinion. :slightly_smiling_face:

I created a github “issue” as a feature request for Cocos Creator to have project specific preview-template folders, the same way build-templates works.

Go and thumbs up / heart or comment on the suggestion if you feel this is something that would help your projects.

1 Like

link is down. fix it plz.

1 Like

http://docs.cocos2d-x.org/creator/manual/en/publish/custom-project-build-template.html

1 Like