README
¶
livereload
livereload is an asset live-reload library that allows easy registration of path & file change monitoring and notifications for livereload-js
Installation
Use go get
go get -u github.com/go-playground/livereload
Usage
see examples:
- basic - an example of live reloading of .css and .js
- advanced - an example of live reloading of .css, .js and .tmpl(template files)
Licenses
- MIT License (MIT), Copyright (c) 2016 Dean Karn
Documentation
¶
Index ¶
Constants ¶
const (
DefaultPort = lrserver.DefaultPort
)
emoji's used in logg messages for at a glance changes.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(livereloadPort uint16, paths []string, mappings ReloadMapping) (done chan struct{}, err error)
ListenAndServe sets up an asset livereload monitor and notification instance. default livereload port is 35729.
if you wish to stop the listener just close the returned 'done' channel
Types ¶
type PreReloadFunc ¶
PreReloadFunc is the reload function, mapped to a given extension just in case you wish to do something before notifying the browser/listener of the change. reload indicates if the reload notification should proceed eg. PreReloadFunc may just compile .sass to .css so no need to notify for the .sass conversion because the .css change will be caught and will trigger the notify.
type ReloadMapping ¶
type ReloadMapping map[string]PreReloadFunc
ReloadMapping is a map of file extensions to their PreReloadFunc's. PreReloadFunc mapping can be nil if nor function needs to be run.