Run docker compose run build-wasm from the root of the repository. You can run tests using docker by running docker compose run test from the root of the repository. In the current implementation of mjml, it is not possible to customize the output of js-beautify.Therefore, to prepare for this move, the wrapper imports html-minifierĪnd js-beautify directly to support minifying and beautifying the output. Beautify and minify will be removed from the library in MJML5 and will be.log ( jsonToXML ( mjml ) ) Differences from the MJML JavaScript library Input := `Hello World` output, err := mjml. This means that the library is thread-safe and you can use it concurrently in multiple goroutines. Idle instances are automatically destroyed and will be re-created when WorkersĪs WebAssembly modules compiled using Javy are not thread-safe and cannot be called concurrently, the library maintainsĪ pool of 1 to 10 instances to perform compilations. On application start up to accept input in order to compile MJML into HTML. The WebAssembly module is then compressed using Brotli to yield a 10x reduction inĭuring runtime, the module is decompressed and loaded into a Wazero runtime This wrapper is then bundled using webpack and compiled into a WebAssembly module using Suborbital’s Javy fork,Ī Javascript to WebAssembly compiler. We wrote a simple JavaScript wrapper that wraps around the MJML library by accepting input and returning output This is why we built mjml-go and created an idiomatic Go API to compile MJML into HTML directly in Go applications thatĬan be deployed as a single Go binary. In addition, running these extra servers introduces extra moving parts The deployed Node.js servers, applications calling these servers will need to be upgraded in a synchronized This approach poses some certain challenges, for example, if MJML is upgraded to a new major version in The usual approach is to wrap the library in a Node.js HTTP server and provide an endpoint through whichĪpplications not written in JavaScript can make HTTP requests to compile MJML into HTML. Compile MJML into HTML directly in your Go application! Why?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |