Skip to content

kordamp/livereload-gradle-plugin

Repository files navigation

livereload-gradle-plugin

Build Status ASL2 Licensed download donations Patreon orange


The livereload-gradle-plugin enables LiveReload on a particular directory via livereload-jvm.

Installation

Option #1

buildscript {
    repositories {
        jcenter()
        gradlePluginPortal()
    }
    dependencies {
        classpath 'org.kordamp.gradle:livereload-gradle-plugin:0.4.0'
    }
}
apply plugin: 'org.kordamp.gradle.livereload'

Option #2

plugins {
    id 'org.kordamp.gradle.livereload' version '0.4.0'
}

Usage

The plugin adds a new task named liveReload. This task exposes the following properties as part of its configuration

Name Option Property Type Default Value

verbose

livereload-verbose

livereload.verbose

boolean

false

port

livereload-port

livereload.port

int

35729

docRoot

livereload-doc-root

livereload.doc.root

String

false

Task properties may be defined on the command line using their option name, or their property name, such as

$ gradle liveReload --livereload-verbose
$ gradle liveReload -Plivereload.verbose=true
$ gradle liveReload -Dlivereload.verbose=true
$ set LIVERELOAD_VERBOSE=true
$ gradle liveReload

You’d usually run the liveReload task in a separate shell as the server is kept alive until the gradle session is killed. Support for forking the JVM process and killing the server via a second command may be added in a future release.

Configuration

This plugin can be used in combination with any task that produces content that should be reload. In particular this plugin detects if the asciidoctor-gradle-plugin is installed, automatically configuring the outputDir of the asciidoctor task as the docRoot. This setting can be overridden by user input of course.