Using wro4jRunner, how do I minimize/process CSS and JS at once?

203 views
Skip to first unread message

Cameron Stokes

unread,
Jul 30, 2011, 6:09:38 PM7/30/11
to wro4j
I'm using wro4jRunner to process files from the command-line. However,
I don't see how to minimize or process CSS and JS in one execution. If
I specify a compressor such as yuiJsMin, then my CSS files don't get
processed. The reverse is true when specifying yuiCssMin.

Am I completely missing something?

Also, what's the difference between a compressor and a processor?

My command and output:
$ java -jar wro4j-runner-1.3.8.1-jar-with-dependencies.jar --
destinationFolder web-app/_packed/ -m -c yuiCssMin
processing group: jquery.css
file size: jquery.css -> 0 bytes
No content found for group: jquery.css
processing group: jquery.js
file size: jquery.js -> 127477 bytes
~/cc/personal/projects/pictab.tmp/web-app/_packed/jquery.js
(127477bytes) has been created!
processing group: pictab.css
file size: pictab.css -> 1974 bytes
~/cc/personal/projects/pictab.tmp/web-app/_packed/pictab.css
(1974bytes) has been created!
processing group: pictab.js
file size: pictab.js -> 13345 bytes
~/cc/personal/projects/pictab.tmp/web-app/_packed/pictab.js
(13345bytes) has been created!
Processing took: 1377ms

Here is my wro.xml:
<groups xmlns="http://www.isdc.ro/wro">

<group name="pictab">
<js>/web-app/js/pictab.js</js>
<css>/web-app/css/pictab.css</css>
</group>

<group name="jquery">
<js>/web-app/js/jquery.1.6.1.min.js</js>
<js>/web-app/js/jquery-ui-1.8.13.custom.min.js</js>
<js>/web-app/js/jquery.ba-hashchange.min.1.3.js</js>
<js>/web-app/js/jquery.hotkeys.0.8.js</js>
<js>/web-app/js/jquery.jsonp-2.1.4.min.js</js>
</group>

</groups>

Alex Objelean

unread,
Jul 30, 2011, 6:25:44 PM7/30/11
to wr...@googlegroups.com
Hi Cameron, 

initially wro4j-runner was created as a fast alternative for wro4j-maven-plugin for compressing js resources. Its purpose was to compress js only. Only in the latest release (1.3.8) it allows using also other processors (like CssMin - for compressing css resources). I'm starting to see the wro4j-runner as being more useful and will make it 'first class citizen' by supporting the same features as wro4j-maven-plugin does. That means that the next release (1.4.0) will allow you to specify a list of (pre & post) processors to be used by wro4j-runner.

The workaround for current version is to run it twice, first time using a js compressor and the second using css compressor.

Regarding compressor vs processor:

- processor - can do much more than just a simple compression. It mutates the resource by adding/removing/transforming/analyzing it. Ex: semicolonAppenderProcessor(add semicolon to the end of each js resource), coffeeScriptProcessor (transform a coffeeScript into js), cssLintProcessor (semantically validates your css and warns you about errors), etc.
- compressor is a processor which makes resource smaller by compressing it, ex: jsMin, cssMin, yui compressor, etc. 

I hope there is no more confusion about this :)

If you have any other questions and suggestions, please let me know.

Regards,
Alex

ted...@gmail.com

unread,
Nov 8, 2011, 12:35:01 PM11/8/11
to wr...@googlegroups.com
Hi Alex,

I'm trying to test out wroj4Runner on a Windows machine and keep getting

[FAIL] Model creation using XmlModelFactory failed

I'm trying to test with a "file" in the resource specification. The file is in the same directory as the jar and xml file

My wro.xml file is

<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.isdc.ro/wro wro.xsd">
  <group name="all">
    <js>file:scripts.js</js>
  </group>
</groups>


What am I doing wrong?

Ted

Reply all
Reply to author
Forward
0 new messages