Skip to content

rgcottrell/sbt-imagemin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-imagemin

Build Status

sbt-web plugin that optimizes images using imagemin on the asset pipeline.

To use the latest version from GitHub, add the following to the project/plugins.sbt of your project:

addSbtPlugin("com.slidingautonomy.sbt" % "sbt-imagemin" % "1.0.1")

Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:

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:

pipelineStages := Seq(imagemin)

Configuration

The plugin will optimize JPEG, GIF, PNG and SVG images for display on the web with a minimum amount of configuration. The default options are:

ImageMinKeys.progressive       := true  // lossless conversion to progressive JPEG images 
ImageMinKeys.interlaced        := true  // interlaced GIF images
ImageMinKeys.optimizationLevel := 3     // optimization level 0 - 7 for PNG images

File Filters

By default, the plugin scans for any assets ending in jpeg, jpg, gif, png, or svg and creates optimized versions of these files. The files to be processed can be filtered using the includeFilter and excludeFilter settings. For example, to optimize only PNG images:

includeFilter in imagemin := "*.png"

Prerequisites

The plugin requires that your project have the imagemin Node module installed. The easiest way to do this is to include a package.json file at the root of your project:

{
  "dependencies": {
    "imagemin": "^3.1.0"
  }
}

About

sbt-web plugin that optimizes images using imagemin

Resources

License

Stars

Watchers

Forks

Packages

No packages published