Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rgcottrell/sbt-html-minifier
sbt-web plugin that adds HTML minification using html-minify
https://github.com/rgcottrell/sbt-html-minifier
Last synced: 26 days ago
JSON representation
sbt-web plugin that adds HTML minification using html-minify
- Host: GitHub
- URL: https://github.com/rgcottrell/sbt-html-minifier
- Owner: rgcottrell
- License: other
- Created: 2014-07-06T02:12:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-12T19:06:49.000Z (over 10 years ago)
- Last Synced: 2024-11-07T04:07:10.909Z (3 months ago)
- Language: Scala
- Size: 164 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sbt-plugins - sbt-html-minifier
README
sbt-html-minifier
=================
[![Build Status](https://travis-ci.org/rgcottrell/sbt-html-minifier.svg?branch=master)](https://travis-ci.org/rgcottrell/sbt-html-minifier)An [sbt-web](https://github.com/sbt/sbt-web) plugin that uses [html-minifier](https://github.com/kangax/html-minifier)
to minify HTML template files.Add the plugin to the `project/plugins.sbt` of your project:
```scala
addSbtPlugin("com.slidingautonomy.sbt" % "sbt-html-minifier" % "1.0.0")
```Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:
```scala
lazy val root = (project in file(".")).enablePlugins(SbtWeb)
```As with all sbt-web asset pipeline plugins, you must declare their order of execution. For example:
```scala
pipelineStages := Seq(htmlMinifier)
```## Options
The plugin is configured with sensible defaults, but can be customized to meet individual requirements. Most of the
same configutation options used by the html-minifier package may be specified. For example, to disable comment
stripping:```scala
HtmlMinifierKeys.removeComments := false
```See the html-minifier home page for information on available options.
## File Filters
By default, the plugin scans the assets directory for any file ending in `.htm` or `.html` and creates new minified
versions of those files. The files to be processed can be filtered using the includeFilter and excludeFilter settings.
For example, to limit minification to just `.tpl.html` template files:```scala
includeFilter in htmlMinifier := "*tpl.html"
```## Prerequisites
The plugin requires that your project have the html-minifier Node module install. The easiest way to do this is to
include a package.json file at the root of your project:```json
{
"dependencies": {
"html-minifier": "^0.6.3"
}
}
```