gpgekko / sbt-autoprefixer   1.3.1

GitHub

sbt-web plugin that adds vendor-specific prefixes to CSS using Autoprefixer

Scala versions: 2.12
sbt plugins: 1.0

sbt-autoprefixer

Build Status

sbt-web plugin that uses postcss-cli to run Autoprefixer to post-process CSS and add vendor prefixes to rules by Can I Use.

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

lazy val sbtAutoprefixer = uri("git://github.com/gpgekko/sbt-autoprefixer")
lazy val root = project.in(file(".")).dependsOn(sbtAutoprefixer)

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)

Declare the execution order of the pipeline:

pipelineStages := Seq(autoprefixer)

Note: if dependency resolving breaks on org.webjars.npm.semver, add the following line to the project/plugins.sbt:

dependencyOverrides += "org.webjars.npm" % "semver" % "5.6.0"

Options

The following options are supported:

Option Description
browsers Which browsers Autoprefixer will support. Default: > 1% in NL, last 2 versions, Firefox ESR
config Contents of the config file. Use this if you want to fine tune the Autoprefixer configuration. Default: the browsers provided above

The following sbt code illustrates how to set the browsers

browsers in autoprefixer := JS.Array("> 5%", "last 4 versions")

To include just one CSS file for post processing

includeFilter in autoprefixer := GlobFilter("mystyle.css")