How to create custom ejs functions/modules for web build template + preview template, to share common js/html/styles?

I want to create common .ejs file with core html for canvas.

Since I want my game canvas to resize automatically with window resize I want js/html/styles to be shared in preview template and build template (for example web-desktop).

I see that Cocos Creator is using some internal functions/templates like <%- include(cocosTemplate, {}) %>

How can I create same separated parts to be used in both places? I want to preview with my fixes and also for build to behave the same.

Nevermind. It’s actually pretty easy. You can include custom .ejs files via usual syntax. For a moment I thought .ejs was processed somewhere internally. Just include local .ejs files with common code.