YUI Compressor中的JQuery文件的压缩问题 [英] Compression issues with JQuery file in YUI Compressor

查看:160
本文介绍了YUI Compressor中的JQuery文件的压缩问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用YUI压缩器缩小几个文件。但是,我似乎得到一个错误,在2行代码,这防止压缩。 jcarouselLite 的.js文件包含1个错误,而我自己的代码包含另一个。 / p>

我已经把它缩小了,在两种情况下,它看起来像在jQuery中使用的float属性导致这。行是:

  li.css({overflow:hidden,float:o.vertical?none:剩下}); (width:80px,float:right})。addClass(jcarousellite)

$(#now-playing .js-kit- rating div:first清算); (自己的代码)

错误的一个工作示例可以通过运行 jCarouselLite代码通过YUI压缩程序,但基本上返回的错误是无效的属性id。



有没有人对YUI压缩程序有类似的问题?

解决方案

它不是YUI本身,它的jcarouselLite js。 float是保留字。它需要放在引号中。 EG:

  li.css({overflow:hidden,float:o.vertical?none:剩下}); 

与您自己的代码类似的问题。 YUI正在尽力编译js,但会拒绝/警告你的代码像你发现的。 IMO正在做正确的事情。


I am trying to minify a few files with YUI compressor. However, I seem to be getting an error on 2 lines of code, which prevents compression. The .js file for jcarouselLite contains 1 error, and my own code contains the other.

I have narrowed it down and in both occasions it looks like the the float property used in jQuery is causing this. The line is:

li.css({overflow: "hidden", float: o.vertical ? "none" : "left"}); (jcarousellite)

$("#now-playing .js-kit-rating div:first").css({width: "80px", float: "right"}).addClass("clearing"); (own code)

A working example of the error can be seen by running the jCarouselLite code through the YUI compressor, but basically the error returned is invalid property id.

Has anyone had similar issues with the YUI compressor?

解决方案

It's not YUI per se, it's the jcarouselLite js. "float" is a reserved word. It needs to be put in quotes. EG:

li.css({overflow: "hidden", "float": o.vertical ? "none" : "left"});

Similar issue with your own code. YUI is trying its best to compile that js but will refuse/warn you of code like the one you found. IMO it's doing the right thing.

这篇关于YUI Compressor中的JQuery文件的压缩问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆