Skip to content


Subversion checkout URL

You can clone with
Download ZIP
An SBT plugin for wro4j
CSS Scala Shell JavaScript
Latest commit 32ffa6c @BowlingX Merge pull request #15 from gitter-badger/gitter-badge
Add a Gitter chat badge to
Failed to load latest commit information.
src build tests agains snapshot version
.travis.yml Update
LICENSE Added Bootstrap css and js Test, now wro4j is invoked before packaging
sbt add sbt-extras script

xsbt-wro4j-plugin Build Status


This plugin provides a Wrapper for

Inspired by wro4j-maven-plugin:


  • sbt 0.13 (use 0.3.0-SNAPSHOT for sbt 0.12)


In your project/plugins.sbt add:

resolvers += Resolver.url("sbt-plugin-snapshots",
  new URL(""))(

addSbtPlugin("com.bowlingx" %% "xsbt-wro4j-plugin" % "0.3.5")

In your build.sbt add:

import com.bowlingx.sbt.plugins.Wro4jPlugin._
import Wro4jKeys._

// import task settings
seq(wro4jSettings: _*)

// If you use xsbt-web-plugin, this will add compiled files to your war file:
(webappResources in Compile) <+= (targetFolder in generateResources in Compile)

Prepare wro4j configuration

Wro4j is configured through wro.xml and file in src/main/webapp/WEB-INF

  • wro.xml contains group definitions for file resources (like css, less, js Files).
  • contains pre -and post processor configuration.

The current implementation reads those provider informations (shortcuts) from classes extending com.bowlingx.sbt.plugins.wro4j.Processors You can easily provide your custom Provider if you override processorProvider in generateResources e.g.

  (processorProvider in generateResources in Compile) := new MyCustomProviderForProcessors

The current build in provider creates the following pre and post processors (will be extended):

  • CssUrlRewritingProcessor
  • CssImportPreProcessor
  • SemicolonAppenderPreProcessor
  • LessCssProcessor
  • CssDataUriPreProcessor
  • CopyrightKeeperProcessorDecorator with JSMinProcessor
  • YUICssCompressorProcessor
  • CoffeeScriptProcessor
  • SassCssProcessor
  • CssDataUriPreProcessor

Example properties file with all available processors:

preProcessors = cssUrlRewriting,cssImport,semicolonAppender,lessCss
postProcessors = yuiCssMin,copyrightMin

Example wro.xml

<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns=""
        xsi:schemaLocation=" wro.xsd">

    <group name="styles">

    <group name="scripts">



This Plugin supports webjars annotation:

<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns=""
        xsi:schemaLocation=" wro.xsd">

    <group name="scripts">

libraryDependencies ++= Seq(
  "org.webjars" % "dropzone" % "3.7.1"

Run compilation

This plugin depends on package and will then compile all your defined groups for you. You also can compile you assets manually if you invoke wro4j.

All assets are written to target/wro4j/compiled/ by default. If you use xsbt-web-plugin and package a war file, your assets will be available in webapp/compiled/groupName.groupSuffix


Any contribution is welcome, just issue a pull-request or bug/feature if you found something :)

Something went wrong with that request. Please try again.