Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Error with data:uri #19

Closed
ai opened this issue Jun 14, 2011 · 13 comments
Closed

Error with data:uri #19

ai opened this issue Jun 14, 2011 · 13 comments

Comments

@ai
Copy link

ai commented Jun 14, 2011

We encode some images with data:uri and put it directly in CSS file (by SASS inline-image function).

But yui-compressor throw error on this CSS-files: /compressor.rb:87:incompress': compression failed (YUI::Compressor::RuntimeError)`

If I put puts stderr.read in compress method, I see YUI error:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
…

So, as I understand, YUI 2.4.4 have problem with data:uri images in CSS.

@kossnocorp
Copy link

+1

@brainopia
Copy link

I already wrote a couple of times before:

Since january 18 (0.9.3, 0.9.4) ruby-yui-compressor is bundled with yui compressor 2.4.4 (although current official version 2.4.2) and this version can't compress stylesheet if it contains an embedded image (i've checked with 16kb image).

So I suggest to rollback to official stable version of yui-compressor for now.

@naltatis
Copy link

I tried to convert my css file with inline data with the yui jar from the command line and got a stackoverflow exception. Increasing the stack size of the java vm solved this problem for me.

Unfortunately ruby-yui-compressor currently has no configuration to manipulate the java runtime so I had to monkeypatch it.

class YUI::Compressor
  def command
    @command.insert 1, "-Xss8m"
    @command.map { |word| Shellwords.escape(word) }.join(" ")
  end
end

@eugenebolshakov
Copy link

+1, Increasing the java vm stack size works

@guyboltonking
Copy link

See also #9, which allows passing in VM flags in via the options hash.

@marcboeker
Copy link

It has helped me to use the YUI Compressor from https://github.com/schleyfox/yuicompressor
Just check it our, use ant to build it and replace ruby-yui-compressor's version of the jar with the freshly build one.

@wizztjh
Copy link

wizztjh commented Aug 26, 2011

@css_compressor = YUI::CssCompressor.new(Jammit.css_compressor_options || {})

#9
YUI::JavaScriptCompressor.new(:java_opts => '-Xmx64M')

so i think this will solve it , but #9 is not merge into master

#asset.yml
compressor_option: 
  java_opts: "-Xss64m"
css_compressor_options: 
  java_opts: "-Xss64m"

@shedd
Copy link

shedd commented Sep 14, 2011

I also ran into this issue with SASS stylesheets - hopefully #9 will be merged soon so that this issue can be resolved!

@lukemelia
Copy link

+1 ran into this today

@jjok
Copy link

jjok commented Oct 12, 2011

Yep. Just found this. Bad times.

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:20)

@ova2
Copy link

ova2 commented Apr 12, 2012

Guys. It should work now with YUI Compressor 2.4.7 http://yuilibrary.com/forum/viewtopic.php?f=94&t=7237&p=31853

With 2.4.6 I got a StackOverflowException with data URIs too. Do you know what Maven repository I can download 2.4.7 from?

@stevecrozz
Copy link
Collaborator

I haven't had a chance to write a test case yet for this issue, but you may want to try upgrading to v0.11.0 of this gem which includes yuicompressor 2.4.7

@stevecrozz
Copy link
Collaborator

I added a test case to make sure no exceptions are raised when processing a data URI in CSS. fc91491

The test case is passing, but I actually can't make it fail even going back to the earliest versions of the yuicompressor jar that were used in this project. Please reach out if you have a failing test case you can contribute.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests