CLI and web app to convert HTML markup to go-app.dev's syntax.
Static binaries are also available on GitHub releases.
You can install them like so:
$ curl -L -o /tmp/html2goapp-cli https://github.com/pojntfx/html2goapp/releases/latest/download/html2goapp-cli.linux-$(uname -m)
$ sudo install /tmp/html2goapp-cli /usr/local/bin
The frontend is also available on GitHub releases in the form of a static .tar.gz
archive; to deploy it, simply upload it to a CDN or copy it to a web server. For most users, this shouldn't be necessary though; thanks to @maxence-charriere's go-app package, html2goapp is a progressive web app. By simply visiting the public deployment once, it will be available for offline use whenever you need it:
To convert HTML to go-app's syntax, simply paste the HTML you want to convert into the Source Code
input and click on Convert
. You may set the component name, go-app package import path and target package using the options.
You can use the CLI to convert a HTML input file to go-app's syntax like so:
$ html2goapp-cli -component PF4Tabs -src example/index.html -pkg example > example/index.go
If you want to use the WebAssembly version of the CLI, use go_js_wasm_exec
:
$ /usr/local/go/misc/wasm/go_js_wasm_exec out/cli/html2goapp-cli.js-wasm.wasm -component PF4Tabs -src example/index.html -pkg example > example/index.go
You can find the example index.html and index.go files in this repository.
Click on an image to see a larger version.
$ html2goapp-cli --help
Usage of html2goapp-cli:
-component string
Name of the component to generate (default "MyComponent")
-goAppPkg string
Package to use for go-app (default "github.com/maxence-charriere/go-app/v9/pkg/app")
-pkg string
Package to generate component in (default "components")
-src string
HTML source file to convert (default "index.html")
- This project would not have been possible were it not for @maxence-charriere's go-app package; if you enjoy using html2goapp, please donate to him!
- The open source PatternFly design system provides the components for the project.
- dave/jennifer enables this project to generate the Go source code in a simple and declarative way.
- All the rest of the authors who worked on the dependencies used! Thanks a lot!
To contribute, please use the GitHub flow and follow our Code of Conduct.
To build and start a development version of html2goapp locally, run the following:
$ git clone https://github.com/pojntfx/html2goapp.git
$ cd html2goapp
$ make run/pwa # To launch the web app
$ make run/cli # To launch the CLI
Have any questions or need help? Chat with us on Matrix!
- You get the
failed to execute 'compile' on 'webassembly': incorrect response mime type. expected 'application/wasm'.
error when trying to launch the web app? Please make sure that you have added the WebAssembly MIME type on your webserver. - Elements are missing in the generated output? Make sure you only have one root HTML element and do not include the
html
,head
orbody
tags in your input.
html2goapp (c) 2021 Felicitas Pojtinger and contributors
SPDX-License-Identifier: AGPL-3.0