Requesting HTML with Inline Scripts

With this method, after each script is fetched, without any conversion, scripts are appended into single <script></script> tag. Since there is no any encoding or conversion on-runtime, stored scripts should be in raw format.

Requesting inline HTML:

InlineScriptRequest[] memory requests = new InlineScriptRequest[](2);
requests[0].name = "myScript1";
requests[0].contractAddress = scriptyStorageContractAddress;

requests[1].name = "myScript2";
requests[1].contractAddress = scriptyStorageContractAddress;

uint256 bufferSize = 100000;

bytes memory htmlFile = IScriptyBuilder(
    scriptyBuilderAddress
).getHTMLInline(requests, bufferSize);

(bufferSize is set to 100000 as an example. In production, it's important to set an exact size. Please check here to lear more about buffer size.)

HTML file output:

<html>
    <body style='margin:0;'>
        <script>
            [myScript1]
            [myScript2]
        </script>
    </body>
</html>

Last updated