Skip to content

yuicompressor spits out 76 errors when minfying pdf.js #710

Closed

Description

@solsticedhiver

Well, I tried to minified the pdf.js with yuicompressor (2.4.6) and it fails with reporting like 76 syntax errors.

What else could I use that does not throw erros like this ?

may be you could fix pdf.js so that it please a little bit more yuicompressor ?

Activity

  1. jviereck commented on Oct 28, 2011

    @jviereck
    Contributor

    Working with some other compression tools, it turns out that the get foo() and set foo() syntax, that we use for some properties, can't get minified/handled by compressors.

    Could this be the case here as well?

  2. solsticedhiver commented on Oct 28, 2011

    @solsticedhiver
    Author

    No. It does not seem to like the variable called 'char' or 'byte' and some property named 'private'

    the patch remove the "syntax errors" found by yuicompressor
    https://gist.github.com/1322918

    Note: the first hunk is not needed. i.e removing double vim modeline and 'use strict'
    yuicompressor choke on line 13972 and I replaced all instances of private, I don't know if it's needed/correct.
    Just double check before applying, please :-)

  3. jviereck commented on Oct 28, 2011

    @jviereck
    Contributor

    @solsticedhiver, thanks for providing this!

    I'm wondering why things like 'private', 'char', 'byte' cause problems with yuicompressor. They aren't JS reserved words [1], so it should be all fine to use them.

    My feeling is we shouldn't change our code due to some software, that doesn't seem to do what it should do.

    @solsticedhiver, have you tried other compressors? Does they have problems as well? Is there a particular reason to use yuicompressor or is it just your flavor compressor?

    [1] https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words

  4. solsticedhiver commented on Oct 28, 2011

    @solsticedhiver
    Author

    about [1], private is mentionned as a reserved future keyword though
    But even in that case properties.private is stil legal if I understand correctly the last paragraph on "Reserved Word usage"

    yuicompressor is the one I have installed here. I was not going to use an online one with a 1MB file, was I ?

    "My feeling is we shouldn't change our code due to some software, that doesn't seem to do what it should do."
    Yes, I agree.
    But that's not a big change either. Just some basic refactoring.

    yuicompressor might have thought it's better to flag those words because they might be reserved in some implementations, From what I read http://javascript.about.com/od/reference/g/rbyte.htm I don't know what standards they talk about. but not a recent one I think...

    May be one need to open a bug report against yuicompresor ??

  5. nateklaiber commented on Dec 22, 2011

    @nateklaiber

    For what it's worth, Google Closure Compiler fails when trying to minify, and I received an exception when using YUI compressor. I haven't found anything that will work to minify pdf.js, even though it's recommended.

  6. sayrer commented on Dec 22, 2011

    @sayrer
    Contributor

    ES3 had a longer list of FutureReservedWords

  7. shenzhuxi commented on Feb 9, 2012

    @shenzhuxi

    I go t "Compilation produced 88 syntax errors." from yuicompressor-2.4.7.jar and commit 7859ef0

  8. jcheng5 commented on Feb 21, 2012

    @jcheng5

    @nateklaiber, Google Closure Compiler actually works if you add the argument --language_in=ECMASCRIPT5 (and results in excellent compression: 737856 (min) / 1248019 (orig) = 0.591)

  9. ExE-Boss commented on Jun 17, 2024

    @ExE-Boss

    The YUI compressor depends on a modified version of Mozilla’s old Rhino JavaScript runtime, which only supports ES3, and char, byte, private, and others are reserved keywords in ES3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions