gomty

package module
v0.0.0-...-121850f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 7 Imported by: 0

README

gomty

Transform html into gomponents

Install

go install github.com/demetrius-oak/gomty/cmd/gomty@latest

Usage

gomty -h
Transform html file to gomponents

Usage:
  gomty [file] [flags]

Flags:
  -h, --help             help for gomty
  -n, --name string      Gomponent name (default "index")
  -p, --package string   Package name (default "components")
  -s, --suffix string    Suffix name (default "Component")

Examples

Local file:
gomty ./user_form.html -p forms -n User -s Form > ./forms/user.go
Remote input:
curl -l https://www.myblog.com/page.html | gomty -n layout
<html>
  <head>
    <title>My website</title>
  </head>
  <body>
    <h1 class="title">My First Heading</h1>
    <p>My first paragraph.</p>
  </body>
</html>

will output:

package components

import (
        g "github.com/maragudk/gomponents"
        . "github.com/maragudk/gomponents/html"
)

func LayoutComponent(children ...g.Node) {

        HTML(
                Head(
                        TitleEl(g.Text("My website"))),
                Body(
                        H1(
                                Class("title"), g.Text("My First Heading")),
                        P(g.Text("My first paragraph."))))

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Transform

func Transform(reader io.Reader, writer io.Writer, opts *Options) error

Transform html content to gomponents

Types

type Options

type Options struct {
	Suffix  string
	Package string
	Name    string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL