我有一个ant构建,将我的javascript连接到一个文件然后压缩它.问题是Visual Studio的默认编码会将BOM附加到每个文件.如何配置ant以去除原本会出现在结果连接文件中间的BOM?
我的googl'ing透露了这个讨论,这是我遇到的确切问题,但没有提供解决方案:http://marc.info/?l = person-user&m = 118598847927096
我使用jQuery创建了一个模块系统.是否有任何类似于Dojo的Shrinksafe的构建系统,可以将我的所有模块文件合并为一个单独的文件进行生产?
YUI Compresser是关于单文件压缩还是支持捆绑模块文件?JavascriptMVC使用Shrinksafe的自定义版本.该方向的任何链接或信息也会有所帮助.提前致谢.
我正在使用YUI Compressor压缩我的Web应用程序中的JS文件.
这是POM插件conf:
<plugin>
<groupId>net.sf.alchim</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jslint</goal>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnWarning>true</failOnWarning>
<nosuffix>true</nosuffix>
<force>true</force>
<aggregations>
<aggregation>
<!-- remove files after aggregation (default: false) -->
<removeIncluded>false</removeIncluded>
<!-- insert new line after each concatenation (default: false) -->
<insertNewLine>false</insertNewLine>
<output>${project.basedir}/${webcontent.dir}/js/compressedAll.js</output>
<!-- files to include, path relative to output's directory or absolute path-->
<!--inputDir>base directory for non absolute includes, default to parent dir of output</inputDir-->
<includes>
<include>**/autocomplete.js</include>
<include>**/calendar.js</include>
<include>**/dialogs.js</include>
<include>**/download.js</include>
<include>**/folding.js</include>
<include>**/jquery-1.4.2.min.js</include>
<include>**/jquery.bgiframe.min.js</include> …Run Code Online (Sandbox Code Playgroud) 我使用了5个JavaScript压缩器来压缩JavaScript库(JSMin,YUI压缩器,Packer,闭包编译器和UglifyJS)
现在我知道闭包编译器是减少文件大小的赢家.但是,我也想测试一下性能提升.这样做有什么好办法?
我做了一个简单的测试页面,它使用了所有库的公共方法.是否有用于测试此测试页面的页面速度的工具?例如.在浏览器上运行X次并返回平均加载速度.
谢谢你的回答!
javascript compression packer yui-compressor google-closure-compiler
我在我的项目中加载了很多JS和CSS.为了提高我的网站性能,我开始使用与ASE构建集成的YUICompression.所以每次我构建项目时都会创建一个附加"-min.js"的缩小文件
示例:构建后的myscript.js,新文件"myscript-min.js".
现在我已经更改了所有文件以在我的页面中加载myscript-min.js.
是否有任何自动化或更简单的方法来加载minify文件.
提前致谢!!!
我正在使用maven构建一个Web应用程序项目,并且打包设置为"war".我还使用YUI压缩器插件来压缩webapp目录中的javascript代码.我已经设置了YUI压缩器,如下所示:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/ext-2.0/**/*.js</exclude>
<exclude>**/lang/*.js</exclude>
<exclude>**/javascripts/flot/*.js</exclude>
<exclude>**/javascripts/jqplot/*.js</exclude>
</excludes>
<nosuffix>true</nosuffix>
<force>true</force>
<jswarn>false</jswarn>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如果我这样做:mvn process-resources,src/main/webapp将被复制到target/webapp-1.0 /目录,并压缩javacripts.但是,当我运行mvn install时,所有压缩的javascripts都会被覆盖,显然打包过程会在构建war文件之前从main/webapp复制一次内容.
我怎么能绕过这个?
我正在寻找包装和minfying Ext JS 4应用程序的事实性说明.
一切似乎都指向Sencha SDK,但是围绕着这一切都是针对Sencha Touch的,无论如何,当我按照指示(sencha app build testing)收到时:
"当前工作目录(C:...)不是公认的Sencha SDK或应用程序文件夹"
这引起了我的兴趣,因为我使用的结构是由Sencha Architect生成的.查看此处的文档,Architect生成的文件夹结构是正确的,但有些文件名不同.似乎有一些我不知道的打包文件(app.json packager.json).
考虑到在开发过程中创建的.js文件的大量负载,我期待大量的帖子/指南/博客/文章,你认为这是一个常见的要求.
我运行php app/console assetic:dump来发布Symfony2应用程序的资产,但是我收到了这个错误:
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/bin/java' '-jar' '/home/devx/public_html/mutualcontratos/app/Resources/java/yuicompressor-2.4.7.jar' '--charset' 'UTF-8' '-o' '/tmp/YUI-OUT-3E8eNl' '--type' 'js' '/tmp/YUI-IN-DmkGnm'
Error Output:
sh: /usr/bin/java: No existe el fichero o el directorio
Run Code Online (Sandbox Code Playgroud)
这意味着找不到java可执行文件.
事实是,我在同一台服务器上有另一个Symfony2应用程序,它在那里工作.我比较了两个config.yml文件,它们是相同的.这个其他应用程序缺少什么?
这是完整的config.xml文件:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
translator: { fallback: es_CL }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: …Run Code Online (Sandbox Code Playgroud) 我正在使用 YUI 压缩器来压缩 js 文件,但是在 Windows7 上传递完整路径时出现错误
java -jar c:\yui\yuicompressor-2.4.8.jar c:\js\CCOM.js -o c:\js\CCOMA.js
Run Code Online (Sandbox Code Playgroud)
给出错误如下
java.io.FileNotFoundException: yuiCCOMA.js:\yui\CCOM.js (The filena
me, directory name, or volume label syntax is incorrect)
Run Code Online (Sandbox Code Playgroud)
jar 和源文件确实存在,当我直接从源目录运行它时它工作正常
我在使用命令行工具 yuicompressor jar 压缩 js 文件时遇到语法错误。
[错误] 1796:28:无效的属性 ID
我有一个变量commentGroup。我想将其作为 JSON 对象推送,值为commentGroup as key. 为了实现这一点,我提到了这个答案。
var commentGroup = 'owner';
var groupIndex= [];
groupIndex.push({[commentGroup]: 1}); // Error line 1796
Run Code Online (Sandbox Code Playgroud)
为什么它告诉无效的属性 ID?
我在用yuicompressor-2.4.7.jar
我已经在JavaScript/CSS/HTML 压缩器上尝试过上面的代码
输出
{
"message": "Unexpected token: name (commentGroup)",
"filename": 0,
"line": 3,
"col": 18,
"pos": 66
}
Run Code Online (Sandbox Code Playgroud)
我觉得YUI压缩器不明白{[commentGroup]: 1}
我得到了上述问题的解决方案,我需要声明临时变量,然后将对象作为键放入该变量中,然后推入数组中。
var commentGroup = 'owner';
var aObject= {};
aObject[commentGroup]= 1;
var groupIndex= [];
groupIndex.push(aObject);
Run Code Online (Sandbox Code Playgroud) yui-compressor ×10
javascript ×5
ant ×2
java ×2
minify ×2
assetic ×1
compression ×1
css ×1
dojo ×1
extjs4 ×1
maven ×1
maven-2 ×1
packer ×1
sencha-cmd ×1
symfony ×1
symfony-2.3 ×1
utf-8 ×1
yui ×1