Sass issues

134 views
Skip to first unread message

Tlvenn

unread,
Oct 5, 2011, 11:35:24 PM10/5/11
to Sass
Hi,

I am new to Sass and I am trying to use it in our java projects thanks
to Jruby. All the basic stuff works with some caveats I don't
understand. I m hoping the nature of errors can help you out pointing
me into the right direction of what is going on... All the issue seems
related to interpolation #{}..

Env: Sass 3.1.7 / JRuby 1.6.4

Issue 1:
-------------------------
$column: 48;
$gutter: 24;

$cols1: #{$column + $gutter}em;

>> (NoMethodError) undefined method `+' for nil:NilClass

Issue 2:
--------------------------
@mixin grid-base(
$base-class: grid-column,
$first-column-class: g-all-f,
$last-column-class: g-all-l
) {
.#{$first-column-class} { margin-left: 0 !important; clear: left; }
.#{$last-column-class} { margin-right: 0 !important; }
}

>> (SyntaxError) <script>:6: syntax error, unexpected tRCURLY
.#{$first-column-class} { margin-left: 0 !important; clear: left; }
^

Issue 3:
--------------------------------
// If i use single quote instead of double quote, it works...
input[type="reset"] {
cursor: pointer;
-webkit-appearance: button;
}

>> (SyntaxError) <script>:1: syntax error, unexpected tIDENTIFIER
Sass::Engine.new("input[type="reset"] {
^


I am pretty sure it is something fairly stupid on my end but I don't
see what and from my lack of expertise with Sass or Ruby, I need your
help :)

Thanks in advance !

Hampton Catlin

unread,
Oct 6, 2011, 10:21:53 AM10/6/11
to sass...@googlegroups.com
Unfortunately, there isn't *official* JRuby support right now. That isn't to say
we aren't more than willing to support it.

Let me look into getting JRuby on my system and see what results we get
for the tests...

-hampton.

> --
> You received this message because you are subscribed to the Google Groups "Sass" group.
> To post to this group, send email to sass...@googlegroups.com.
> To unsubscribe from this group, send email to sass-lang+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sass-lang?hl=en.
>

Tlvenn

unread,
Oct 6, 2011, 12:09:24 PM10/6/11
to Sass
Thanks Hampton !

Issue 3 is fixed and was a rather stupid one... basically given how
the template is passed to sass (as a concatened string within a Java
string), double quotes have to be replaced with single quotes.

Before : engine = (RubyObject)
container.runScriptlet("Sass::Engine.new(\"" + template + "\", {" +
params + "})");
Now: engine = (RubyObject)
container.runScriptlet("Sass::Engine.new(\"" +
template.replaceAll("\"", "'") + "\", {" + params + "})");

Now the real issues remains and all tied to interpolation.

--
Chris

Nathan Weizenbaum

unread,
Oct 6, 2011, 4:04:23 PM10/6/11
to sass...@googlegroups.com
I believe all your issues have to do with how you're passing the template to Sass. Isn't there a better way to invoke Ruby classes from Java than what you're using?

Tlvenn

unread,
Oct 6, 2011, 11:18:22 PM10/6/11
to Sass
Thanks Nathan for your feedback, it pointed me into the right
direction !

I am now doing this instead :

RubyModule Sass = (RubyModule) container.runScriptlet("Sass");
return (String) container.callMethod(Sass, "compile", template);

And it works just fine now :)
There should be a way to construct the Engine programmatically as well
but since the Sass module has a facade for what I am trying to do,
it's enough.

Thanks again, everyone !
Reply all
Reply to author
Forward
0 new messages