sbt-web plugin for minifying/compressing CSS assets


Test Workflow Release Notes Maven Central Apache License 2.0 Scala Steward badge

This is a fork of basedRNC/sbt-css-compress.

sbt-web plugin which compresses CSS using yuicompressor.


Add the plugin to your project/plugins.sbt:

addSbtPlugin("de.lolhens" % "sbt-css-compress" % "0.2.0")

Enable the sbt-web plugin for your project:

lazy val root = (project in file(".")).enablePlugins(SbtWeb)

Add the css-compress task to your asset pipeline in your build.sbt:

pipelineStages := Seq(cssCompress)

Configuration options

Option Description
cssCompressSuffix Extension to append to each compressed file. Defaults to ".min.css"
cssCompressParentDir Parent directory name where compressed CSS will go. Defaults to "", which outputs the file into the base target directory
cssCompressLineBreak Number of characters on a line before attempting to insert a line break. This is merely a hint to the compressor. Defaults to -1 (never)

An example of providing an option is below:

cssCompressSuffix := ".min.css"

This will produce assets with the specified cssCompressSuffix suffix value under the cssCompressParentDir directory within the target folder. This will be target/web/public/main or target/web/stage. You can also specify includeFilter in cssCompress or excludeFilter in cssCompress to select files on a custom criteria.


This code is licensed under the MIT License.