livereload

package module
v0.0.0-...-a0f7217 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: MIT Imports: 7 Imported by: 1

README

livereload

Project status Go Report Card GoDoc License

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

Documentation

Index

Constants

View Source
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

type PreReloadFunc func(name string) (reload bool, err error)

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.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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