diff --git a/README.md b/README.md index 7361632..95c5cdd 100644 --- a/README.md +++ b/README.md @@ -6,53 +6,41 @@ # Gradle HTL Plugin -This plugin is Gradle port of existing [Apache Sling HTL Maven Plugin](https://github.com/apache/sling-htl-maven-plugin). - -It is simple Gradle Plugin for eager AEM [HTML Template Language](https://docs.adobe.com/content/help/en/experience-manager-htl/using/overview.html) (HTL) files validation. Usually, HTL files get compiled when component is rendered on AEM. If it contain any errors, those won't be spotted during deployment. This plugin performs HTL files compilation just before deployment to prevent introducing unintended bugs. +Gradle equivalent to [Apache Sling HTL Maven Plugin](https://github.com/apache/sling-htl-maven-plugin). # Compatibility -This plugin has been tested with Gradle versions (5.0.0+). -# Usage +Tested with Gradle 6.0.0 and above. -Plugin setup `buildSrc/build.gradle.kts`: +# Setup -```kotlin -repositories { - maven { url = uri("http://dl.bintray.com/cognifide/maven-public") } -} +Plugin is released in Gradle Plugin Portal. See notes from [there](https://plugins.gradle.org/plugin/com.cognifide.htl). -dependencies { - implementation("com.cognifide.gradle:htl-plugin:0.0.1") -} -``` +## Usage -Apply plugin in your `build.gradle.kts` script: -```kotlin -plugins { - id("com.cognifide.gradle.htl") -} - -plugins.apply("com.cognifide.gradle.htl") -``` - -## Running - -To run plugin simply type `gradlew htlValidate` in commandline. +Simply run the task `gradlew htlValidate`. # Configuration -You can configure few things: -1. Directory where your HTL files are stored (to avoid redundant scanning) -2. List of supported extensions (files recognized as HTL templates) -3. Decide if plugin will fail when warning is present. By default it fails only on errors. - Sample configuration (shown values are plugin defaults): + ```kotlin -htlValidation { - directory("src/main/content/jcr_root/") - extensions("**/*.html", "**/*.htl") - failOnWarnings() +htl { + sourceDir("src/main/content/jcr_root") + sourceFilter { + include("**/*.html", "**/*.htl") + exclude("**/some-subdir/*") + } +} + +tasks { + htlValidate { + /* + failOnWarnings() // or via property: htl.validator.failOnWarnings=true + printIssues() // or via property: htl.validator.printIssues=true + enabled = false // or via property: htl.validator.enabled=false + */ + } } ```