MCPcopy Index your code
hub / github.com/tdewolff/minify / ExampleMinify

Function ExampleMinify

html/html_test.go:559–573  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

557////////////////////////////////////////////////////////////////
558
559func ExampleMinify() {
560 m := minify.New()
561 m.AddFunc("text/html", Minify)
562 m.AddFunc("text/css", css.Minify)
563 m.AddFunc("image/svg+xml", svg.Minify)
564 m.AddFuncRegexp(regexp.MustCompile("^(application|text)/(x-)?(java|ecma)script$"), js.Minify)
565 m.AddFuncRegexp(regexp.MustCompile("[/+]json$"), json.Minify)
566 m.AddFuncRegexp(regexp.MustCompile("[/+]xml$"), xml.Minify)
567
568 // set URL to minify link locations too
569 m.URL, _ = url.Parse("https://www.example.com/")
570 if err := m.Minify("text/html", os.Stdout, os.Stdin); err != nil {
571 panic(err)
572 }
573}
574
575func ExampleMinify_options() {
576 m := minify.New()

Callers

nothing calls this directly

Calls 3

AddFuncMethod · 0.80
AddFuncRegexpMethod · 0.80
MinifyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…