missing ; before statement....

161 views
Skip to first unread message

Chuckie

unread,
Sep 3, 2010, 3:49:12 PM9/3/10
to SquishIt
I'm getting the "missing ; before statement" (Firebug) when I
squishit. In debug mode everything works fine. Has anyone seen this
problem?

Thanks,

Chuck

Justin Etheredge

unread,
Sep 3, 2010, 5:20:57 PM9/3/10
to squi...@googlegroups.com
This is a known bug that is going to be fixed in an soon to be released SquishIt 0.6.1. Essentially the ajax minifier is compressing the files separately before we are combining them into one. This can cause the issue you are seeing. The fix in the meantime is to use the WithCompressor option and switch to something like the YUI compressor temporarily.

Chuckie

unread,
Sep 3, 2010, 5:29:08 PM9/3/10
to SquishIt
Thanks, that did the trick. I appreciate the prompt reply.

Chuck

Justin Etheredge

unread,
Sep 3, 2010, 5:45:50 PM9/3/10
to squi...@googlegroups.com
I just pushed a 0.6.1 release, could you please download that and tell me if it fixed your problem.

Please remove the call to "WithCompressor". Thanks!

Chuckie

unread,
Sep 3, 2010, 6:29:10 PM9/3/10
to SquishIt
This is the error I am getting now:

eval(function (e, d, a, c, b, f) {b = function (a) {return (a < d ?
"" : b(parseInt(a / d))) + ((a = a % d) > 35 ? String.fromCharCode(a +
29) : a.toString(36));};if (!"".replace(/^/, String)) {while (a--)
{f[b(a)] = c[a] || b(a);}c = [function (a) {return f[a];}];b =
function () {return "\\w+";};a = 1;}while (a--) {if (c[a]) {e =
e.replace(new RegExp("\\b" + b(a) + "\\b", "g"), c[a]);}}return e;}
("h.i['1a']=h.i['z'];h.O(h.i,{y:'D',z:9(x,t,b,c,d){6 h.i[h.i.y]
(x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/
=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--
t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6
c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2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3;e(a<8.w(c))
{a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-
s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/
=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/
(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))
+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:
9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:
9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},
16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))
+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d)
{6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6
c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m
e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-
=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.
5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});", 62, 74, "||||||return||Math|
function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|
asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|
easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|
easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|
easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|
easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|
easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|
25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|
easeInOutBounce".split("|"), 0, {})) is not a function

http://development.thememorablemoments.org/js/showphoto.2.1.0.371.js?r=CE01E26C6BF12A60016A0FD3DFA18733
Line 16

:(

Justin Etheredge

unread,
Sep 4, 2010, 9:48:56 AM9/4/10
to squi...@googlegroups.com
It looks like the Microsoft Ajax minifier is being too agressive in the minification of your code and is breaking something. I would recommend continuing to use an alternate minifier which works for you until I can get in some code to allow you to modify the settings on the Ajax Minifier. It has some knobs to tweak. Sorry for your troubles!

Sean Chambers

unread,
Oct 1, 2010, 3:15:42 PM10/1/10
to SquishIt
Hey Justin,

We are still seeing this error with 0.6.1 when we do the following:

.WithMinifier(JavaScriptMinifiers.Yui)
.Render("~/js/combined.js")

What motivated us to try using a different compressor is compression
bug/quirk when using the default ms ajax minifier:

syntax error
a=d[b];while(a.charAt(0)==" ")a=a.subs...$
("#myButton").click(function(){var

Any ideas?

Sean
> >http://development.thememorablemoments.org/js/showphoto.2.1.0.371.js?...

Sean Chambers

unread,
Oct 1, 2010, 3:19:24 PM10/1/10
to SquishIt
As a quick followup, using the JsMin minifier seems to have fixed both
our problems. Kind of odd.

Sean

Justin Etheredge

unread,
Oct 1, 2010, 3:23:06 PM10/1/10
to squi...@googlegroups.com
In 0.6.2 I am planning on letting you adjust settings in the different minifiers. The JsMin minifier is much less aggressive than either the YUI or MS minifiers. Both the YUI and MS minifiers can be tweaked to tell them how aggressive you want them to be. Currently SquishIt is just using the default settings.

Justin

Justin Etheredge

unread,
Oct 1, 2010, 4:44:39 PM10/1/10
to SquishIt
I just pushed up a SquishIt 0.6.2 beta. It allows for instances of
compressors to be passed in order to configure them. Something like:

var tag = javaScriptBundle
.Add("~/js/test.js")
.WithMinifier(new MsMinifier(codeSettings))
.Render("~/js/output.js");

This code is not yet in the master branch. Could you guys try it out
and let me know how it goes?

Thanks,
Justin

Sean Chambers

unread,
Oct 1, 2010, 4:58:20 PM10/1/10
to squi...@googlegroups.com
Sure.

What are the settings that we should be passing to the YUI compressor
to not be as aggressive with the compression?

Thanks man!

Sean

On Oct 1, 2010, at 4:44 PM, Justin Etheredge <jus...@etheredge.us>
wrote:

> I just pushed up a SquishIt 0.6.2 beta. It allows for instances of

Justin Etheredge

unread,
Oct 1, 2010, 5:09:35 PM10/1/10
to squi...@googlegroups.com
The constructor for the YUI compressor only has a few options, but one of them involves not stripping out semicolons. That should do the trick for you.

Hope it works out!

Justin

c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/

2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d)
{6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t
+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:

9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/
2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-

c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},
12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?
b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)
+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/
2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-
c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:
9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6
c/2*(8.o(1-(t-=2)*t)
+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b

+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-
(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f
s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6
b+c;e(!p)p=d*.3;e(a<8.w(c))
{a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-
s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6
b;e((t/
=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/

(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))
+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:
9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:
9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},
16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))
+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d)

Sean Chambers

unread,
Oct 6, 2010, 11:35:53 AM10/6/10
to SquishIt
I couldn't find the constructor argument on the YUI compressor that
shuts off the stripping of semicolons.

It seems now using any minifier causes our scripts to blow up. I've
tried MsMinifier, YUI and JsMin with no luck.

Sean Chambers

unread,
Oct 6, 2010, 11:40:50 AM10/6/10
to SquishIt
Here some more debugging info. We have approxmately 50 js files that
we are combining together (this is a large application), and after the
bundling we are trying to pass some contextual variables into our js
files from spark. There is a syntax error somewhere in the js, it
almost seems like the bundling isn't completing in time before the
contextual setup is being processed:



<script type="text/javascript">
common.SITEROOT = "${SiteRoot}";
</script>

common.js is being loaded via squishit but it seems like it's not
loading in time. thoughts?

Justin Etheredge

unread,
Oct 6, 2010, 12:03:02 PM10/6/10
to squi...@googlegroups.com
I don't really see how it couldn't be loading in time. The compressing is done when the page is rendered, so the script tag wouldn't be rendered before the combining and minification is done. Browsers also inline download and interpret javascript for the exact reason that you are pointing out. They can't let timing interfere with the code. If there is a syntax error then it could be that the browser isn't creating something that you are expecting to exist, like the "common" object.

In terms of the minification being done, well, that is basically out of my hands. SquishIt just hands a big chunk of JavaScript over to one of the minifiers, and then they pass it back. It isn't doing any manipulation of the JavaScript in the meantime. I would tell you to pass your JavaScript through JSLint, in order to make sure you aren't doing anything funky, but if you have 50 files and they are large, you could be looking at a TON of errors.

One thing that you might want to check though is semi-colons at the end of files. A browser might interpret a missing semi-colon at the end of the file correct if the code is in a separate file, but SquishIt pushes them all together before it sends them to the compressor, so it wouldn't know to add a semi-colon, and the compressor wouldn't do that either. Worth a shot I guess.

Thanks,
Justin

Sean Chambers

unread,
Oct 8, 2010, 8:27:17 AM10/8/10
to SquishIt
Ok,

I think i've tracked down the source of our problem. Our designer
added in a js file to the compression earlier in the week thats really
hacked together. After removing this file it looks like its working
now. the utlity is called the "styleswitch stylesheet switcher". I'm
currently digging into why this is causing a problem.

Thanks for your help Justin.

Sean

On Oct 6, 12:03 pm, Justin Etheredge <jus...@etheredge.us> wrote:
> I don't really see how it couldn't be loading in time. The compressing is
> done when the page is rendered, so the script tag wouldn't be rendered
> before the combining and minification is done. Browsers also inline download
> and interpret javascript for the exact reason that you are pointing out.
> They can't let timing interfere with the code. If there is a syntax error
> then it could be that the browser isn't creating something that you are
> expecting to exist, like the "common" object.
>
> In terms of the minification being done, well, that is basically out of my
> hands. SquishIt just hands a big chunk of JavaScript over to one of the
> minifiers, and then they pass it back. It isn't doing any manipulation of
> the JavaScript in the meantime. I would tell you to pass your JavaScript
> through JSLint, in order to make sure you aren't doing anything funky, but
> if you have 50 files and they are large, you could be looking at a TON of
> errors.
>
> One thing that you might want to check though is semi-colons at the end of
> files. A browser might interpret a missing semi-colon at the end of the file
> correct if the code is in a separate file, but SquishIt pushes them all
> together before it sends them to the compressor, so it wouldn't know to add
> a semi-colon, and the compressor wouldn't do that either. Worth a shot I
> guess.
>
> Thanks,
> Justin
>
> > > > >>>  On Sep 3, 2:45 pm, Justin Etheredge...
>
> read more »

Justin Etheredge

unread,
Oct 8, 2010, 8:31:29 AM10/8/10
to squi...@googlegroups.com
Glad you got it figured out! The compressors can definitely mess things up if you have some sneaky JavaScript :-)

Justin
Reply all
Reply to author
Forward
0 new messages