Documentation ¶
Overview ¶
Package viewer provides a library to make rendering just your component a snap so that it is easy to view visual changes quickly without loading up an entire website. As the styles are contained within the component, this should allow changes to be tested locally instead of within context of a larger page.
Usage:
var ( port = flag.Int("port", 8080, "The port to run the server on") ) func main() { // Some test data to show. conf := &config.VideoFiles{ &config.VideoFile{ Index: 0, Name: "Grand Tetons", URL: "https://vimeo.com/19777306", }, } // Create component with test data. nav, err := nav.New("nav-component", conf, nil) if err != nil { panic(err) } // Render it to 127.0.0.1:8080 v := viewer.New( *port, nav, viewer.BackgroundColor("black"), viewer.ServeOtherFiles("../../../", []string{".css", ".jpg", ".svg", ".png"}), ) v.Run() }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(v *Viewer)
Option provides an optional argument to New().
func BackgroundColor ¶
BackgroundColor changes the default background color from white to the color passed. This helps for styles utilize white and can't be seen. Does not work if UseDoc() was passed as an option.
func ServeOtherFiles ¶
ServeOtherFiles looks at path "from" and serves files below that directory with the extensions in "exts". Extensions should be like ".png" or ".css".