Documentation
¶
Overview ¶
writer package contains Writer struct to write out gorilla css token stream.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer to write gorilla css token stream to a io.Writer.
Example ¶
package main import ( "bytes" "fmt" "github.com/redforks/css-1/scanner" "github.com/redforks/css/writer" ) func main() { css := ` // comment .foo { color: white; } ` s, buf := scanner.New(css), bytes.Buffer{} w := writer.New(&buf) for to := s.Next(); to.Type != scanner.TokenEOF; to = s.Next() { w.Write(to) } if err := w.Close(); err != nil { fmt.Print(err) } else { fmt.Print((string)(buf.Bytes())) } }
Output: // comment .foo { color: white; }
Click to show internal directories.
Click to hide internal directories.