eclipsesassantliferayliferay-theme

Liferay 6.2 Ant Build - Upgrade SCSS compiler


I am currently developing a liferay theme, but when compiling one of the SCSS files, I get the following error:

 [java] Sass::SyntaxError: Invalid CSS after "  @each $key": expected "in", was ", $num in $map {"
 [java]            expected at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:1147
 [java]            expected at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:1084
 [java]                tok! at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:1079
 [java]      each_directive at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:248
 [java]                send at org/jruby/RubyKernel.java:2093
 [java]   special_directive at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:174
 [java]           directive at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:146
 [java]         block_child at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:553
 [java]      block_contents at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:545
 [java]               block at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:534
 [java]     mixin_directive at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:186
 [java]                send at org/jruby/RubyKernel.java:2093
 [java]   special_directive at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:174
 [java]           directive at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:146
 [java]         block_child at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:552
 [java]      block_contents at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:542
 [java]          stylesheet at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:82
 [java]               parse at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/scss/parser.rb:27
 [java]            _to_tree at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/engine.rb:342
 [java]             to_tree at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/engine.rb:272
 [java]        visit_import at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:225
 [java]                send at org/jruby/RubyKernel.java:2097
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:37
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:100
 [java]        visit_import at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:227
 [java]             collect at org/jruby/RubyArray.java:2318
 [java]        visit_import at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:227
 [java]                send at org/jruby/RubyKernel.java:2097
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:37
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:100
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:53
 [java]             collect at org/jruby/RubyArray.java:2318
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:53
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:109
 [java]    with_environment at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:121
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:108
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:37
 [java]          visit_rule at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:320
 [java]                send at org/jruby/RubyKernel.java:2097
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:37
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:100
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:53
 [java]             collect at org/jruby/RubyArray.java:2318
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:53
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:109
 [java]    with_environment at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:121
 [java]      visit_children at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:108
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:37
 [java]          visit_root at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:128
 [java]                send at org/jruby/RubyKernel.java:2097
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/base.rb:37
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:100
 [java]                send at org/jruby/RubyKernel.java:2097
 [java]               visit at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/visitors/perform.rb:7
 [java]              render at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/tree/root_node.rb:20
 [java]             _render at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/engine.rb:315
 [java]              render at C:/Users/BARRYC~1/AppData/Local/Temp/liferay/ruby/gems/sass-3.2.12/lib/sass/../sass/engine.rb:262
 [java]              (root) at <script>:48
 [java] Exception in thread "main" org.jruby.embed.EvalFailedException: (SyntaxError) Invalid CSS after "  @each $key": expected "in", was ", $num in $map {"
 [java]     at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)
 [java]     at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1231)
 [java]     at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1224)
 [java]     at com.liferay.portal.scripting.ruby.RubyExecutor.doEval(RubyExecutor.java:189)
 [java]     at com.liferay.portal.scripting.ruby.RubyExecutor.eval(RubyExecutor.java:229)
 [java]     at com.liferay.portal.scripting.ruby.RubyExecutor.eval(RubyExecutor.java:129)
 [java]     at com.liferay.portal.tools.SassToCssBuilder._parseSassFile(SassToCssBuilder.java:288)
 [java]     at com.liferay.portal.tools.SassToCssBuilder._parseSassDirectory(SassToCssBuilder.java:247)
 [java]     at com.liferay.portal.tools.SassToCssBuilder.<init>(SassToCssBuilder.java:139)
 [java]     at com.liferay.portal.tools.SassToCssBuilder.main(SassToCssBuilder.java:93)
 [java] Caused by: org.jruby.exceptions.RaiseException: (SyntaxError) Invalid CSS after "  @each $key": expected "in", was ", $num in $map {"
 [java] Unable to parse /css/aui.css
 [java] Java Result: 1

The offending file (aui.css):

$FontAwesomePath: "aui/font-awesome-5/font" !default;

//@import "aui/alloy-font-awesome/scss/variables";
//@import "aui/alloy-font-awesome/scss/mixins-alloy";
//@import "aui/alloy-font-awesome/scss/path-alloy";

.aui {
    @import "aui_variables";

    $iconSpritePath: '../images/aui/glyphicons-halflings.png' !default;
    $iconWhiteSpritePath: '../images/aui/glyphicons-halflings-white.png' !default;

    //@import "aui/bootstrap"; // Remove >> Bootstrap 2.3.2
    @import "aui/variables-alloy";
    @import "aui/variables";
    @import "aui/bs4/bootstrap"; // Add >> Bootstrap 3.5
}

I am using Liferay 6.2 EE GA1, and this error from what I have read, can possibly be fixed by upgrading the SCSS compiler (ruby gem). However, I have -no- clue how to even approach that. It is using the ant builder (build.xml).

If I can either fix the error above, or upgrade the compiler (or both?) it would be great!


Solution

  • If you want to manually upgrade the SASS version, you could re-set the scripting.jruby.load.paths property. Please have a look at 6.2 Portal Properties. So you are not using classpath or java.io.tmpdir but a different folder instead. However, i did not test this, and maybe something else will fail with this upgrade (also you need a concept about CI build).