Building HTML on-chain
Last updated
Last updated
ScriptyBuilder
provides multiple ways of assembling JS.
With this method, ScriptyBuilder
appends all scripts into a single <script></script>
tag. Since scripts are appended without any conversion and encoding, they should be stored in raw format.
With this method, ScriptyBuilder
wraps each script with various <script></script>
tags.
Scripty supports multiple wrapping methods and also custom wrapping. Please check out for more details.
With this method, ScriptyBuilder
wraps each script with various URL encoded <script></script>
tags.
Since inline method has no any wrapping and it's designed to be used with raw scripts, building HTML usually costs less gas. This method is useful if all the scripts are stored in raw format.
With wrapped method you can assemble scripts with different compression types. This is useful if you want to assemble scripts with different compression types.
URL safe method is the most gas efficient way that ScriptyBuilder
provides. It's tuned for embedding HTML file into JSON metadata for NFT tokenURI()
method. It is very similar to wrapped method but the difference is, HTML tags and script tags are double URL encoded. This means, HTML file doesn't need to be encoded in base64 while adding to JSON.
This method is tuned for embedding HTML into metadata JSON for NFT tokenURI()
method. Please check out for more details.