sasswro4j

Sass variable arguments syntax not working in wro4j's rubySassCss


I'm implementing Sass support in our Java application. As we already have wro4j (in the newest version 1.7.5), I decided on using it's rubySassCss as a pre-processor. I got it all configured and the whole thing process .scss files alright, until I use some of the newer syntax.

I get errors when using features that were brought in VIII 2012 with 3.2.0 version of Sass (http://sass-lang.com/documentation/file.SASS_CHANGELOG.html), that is variable arguments ("$args..." syntax) and block of contents in the mixin declarations.

@mixin mix($arg...) {
  font-size: 12px;
}

.class {
  color: black;
}

For example the above simple .scss file throws when processed by rubySassCss:

2014-06-13 11:13:48,574 DEBUG [ro.isdc.wro.http.WroFilter] Exception occured
ro.isdc.wro.WroRuntimeException: org.jruby.embed.EvalFailedException: (SyntaxError) Invalid CSS after "@mixin mix($arg": expected ")", was "...) {"
        at ro.isdc.wro.extensions.processor.support.sass.RubySassEngine.process(RubySassEngine.java:70)
        at ro.isdc.wro.extensions.processor.css.RubySassCssProcessor.process(RubySassCssProcessor.java:59)
        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:89)
        at ro.isdc.wro.model.resource.processor.decorator.LazyProcessorDecorator.process(LazyProcessorDecorator.java:49)
        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:89)
        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:89)

That wouldn't surprise me that much, if not the fact that wro4j release notes (https://code.google.com/p/wro4j/wiki/ReleaseNotes) clearly states that they implemented Sass processor 3.2.1 a long time ago in IX 2012:

Release 1.5.0 Date: 27 Sep 2012

(...)

Issue523 Upgrade rubySassCss processor to 3.2.1

Anybody can tell me if they have the same problem or know what can cause it? I'd really like to take advantage of that variable arguments syntax.


Here's my pom.xml as well:

<dependency>
  <groupId>ro.isdc.wro4j</groupId>
  <artifactId>wro4j-core</artifactId>
  <version>1.7.5</version>
</dependency>
<dependency>
  <groupId>ro.isdc.wro4j</groupId>
  <artifactId>wro4j-extensions</artifactId>
  <version>1.7.5</version>
</dependency>

Solution

  • Looks like you just need to force sass-gems to 3.2.1 version. wro4j should force that itself but it seems it didn't (it used 3.1.9 version instead). Anyway the solution is to add this anywhere in your pom.xml:

    <dependency>
      <groupId>me.n4u.sass</groupId>
      <artifactId>sass-gems</artifactId>
      <version>3.2.1</version>
    </dependency>