minify

package
v0.0.0-...-d039ecd Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = cli.Command{

	Name:    "minify",
	Aliases: []string{"m"},
	Usage:   "minify html",
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "src, s",
			Usage: "source folder",
		},

		cli.StringSliceFlag{
			Name:  "ext, e",
			Value: &cli.StringSlice{".html", ".xhtml"},
			Usage: "file extensions",
		},
	},
	Action: func(c *cli.Context) error {
		src := c.String("src")
		if len(src) == 0 {
			cli.ShowCommandHelp(c, "minify")
			return nil
		}

		m := _minify.New()

		m.AddFunc("text/html", html.Minify)

		return filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
			if err != nil {
				return err
			}
			if info.IsDir() {
				return nil
			}
			for _, f := range c.StringSlice("ext") {
				if filepath.Ext(info.Name()) == f {
					return min(m, src, path)
				}
			}
			return nil
		})
	},
}

Command minify

Functions

This section is empty.

Types

type HTML

type HTML struct {
	XMLName xml.Name `xml:"html"`
	Head    Head     `xml:"head"`
	Body    string   `xml:"body"`
}

HTML html tag

type Head struct {
	Title string
}

Head head tag

Jump to

Keyboard shortcuts

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