Documentation
¶
Overview ¶
Package bootstrap provides middleware and HTTP handlers for serving embedded Bootstrap assets and appending references to them to HTML output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendAssetHandlers ¶
func AppendAssetHandlers(mux *http.ServeMux, opts *BootstrapOptions) error
AppendAssetHandlers appends handlers for the embedded Bootstrap assets to 'mux'. If 'opts.RollupAssets' is true multiple JavaScript or CSS assets are served as a single minified rollup file.
func AppendResourcesHandler ¶
func AppendResourcesHandler(next http.Handler, opts *BootstrapOptions) http.Handler
AppendResourcesHandler will rewrite any HTML produced by previous handler to include the necessary markup to load Bootstrap JavaScript files and related assets.
Types ¶
type BootstrapOptions ¶
type BootstrapOptions struct {
// A list of relative Bootstrap Javascript URLs to append as resources in HTML output.
JS []string
// A list of relative Bootstrap CSS URLs to append as resources in HTML output.
CSS []string
// AppendJavaScriptAtEOF is a boolean flag to append JavaScript markup at the end of an HTML document
// rather than in the <head> HTML element. Default is false
AppendJavaScriptAtEOF bool
// RollupAssets is a boolean flag to serve multiple JS and CSS assets as single minified "rollup" files.
RollupAssets bool
// Prefix is an optional URL path prefix to prepend to all asset URLs.
Prefix string
}
BootstrapOptions provides a list of JavaScript and CSS links to include with HTML output.
func DefaultBootstrapOptions ¶
func DefaultBootstrapOptions() *BootstrapOptions
DefaultBootstrapOptions returns a *BootstrapOptions struct with default paths and URIs.
func (*BootstrapOptions) EnableJavascript ¶
func (opts *BootstrapOptions) EnableJavascript()
EnableJavascript appends the Bootstrap JavaScript bundle to the list of JavaScript URLs in 'opts'.
