html

package
v0.0.0-...-69391d1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2015 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

package 'html' offers means to reduce the size of a given html-document it's similar naive and simplistic as 'css' but it yields good-enough results to be usable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExtraNewlines

func AddExtraNewlines(z *tokenizer) error

config-option: add a newline after certain html-tags to keep some readability in the reduced document. newlines are added after <!doctype html>, <html>,</html>, <head>,</head>, </title>, </script>, </style>, <link>, <body>,</body>

func DontStripComments

func DontStripComments(z *tokenizer) error

func Reduce

func Reduce(writer io.Writer, reader io.Reader, configs ...Config) (err error)

reads html-document from 'reader' and writes the reduced form of the document to 'writer'. example:

ReduceFile(os.Stdout, "index.html", AddExtraNewlines)

'Reduce' tries to not change any semantics of the given document. eg, it lets <script>, <style> and <pre> tokens "mostly" unaltered (no wspace changes, just some html-escaping inside <pre>)

func ReduceFile

func ReduceFile(writer io.Writer, path string, configs ...Config) error

convinience wrapper around Reduce(): opens a file 'path' and writes the reduced form of the document to 'writer'. see Reduce() for more information.

Types

type Config

type Config func(*tokenizer) error

func-type to tweak the way html.Reduce() works

Jump to

Keyboard shortcuts

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