bowlingx / xsbt-wro4j-plugin

An SBT plugin for wro4j

Version Matrix

xsbt-wro4j-plugin Build Status

![Gitter]( Chat.svg)

DEPRECATED: This plugin is not developed anymore. If you search for asset management with webpack for play, please checkout

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 :)