是否有办法在没有Sencha CMD的情况下缩小ExtJS应用程序? [英] Is there a way to minify an ExtJS application without Sencha CMD?

查看:188
本文介绍了是否有办法在没有Sencha CMD的情况下缩小ExtJS应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用ExtJS 4.2.1开发的ExtJS应用程序。
我通过Maven插件minify-maven-plugin使用Closure minifier。
生成的最小JS文件(不合并)工作正常。
然而,生成的合并的最小化文件抛出未定义的错误,因为定义在合并文件中稍后。
我的问题是,有没有办法找出我必须提供插件的顺序? (我不想使用Sencha Cmd)



应用程序文件夹遵循结构



app / common ,app / controller,app / model,app / proxy,app / store,app / utils,app / view



目前这是我如何定义构建Maven POM文件中的处理

 < plugins> 
< plugin>
< groupId> com.samaxes.maven< / groupId>
< artifactId> minify-maven-plugin< / artifactId>
< version> 1.7.4< / version>
<执行>
< execution>
< id> default-minify< / id>
< phase> prepare-package< / phase>
< goals>
< goal> minify< / goal>
< / goals>
< inherited> false< / inherited>
< configuration>
< charset> UTF-8< / charset>
<! - < skipMerge> true< / skipMerge> - >
< webappSourceDir> $ {basedir} / src / main< / webappSourceDir>
< jsSourceDir> js / app< / jsSourceDir>
< jsTargetDir> js / app< / jsTargetDir>
< jsEngine> CLOSURE< / jsEngine>
< closureLanguage> ECMASCRIPT5< / closureLanguage>
< closureAngularPass> true< / closureAngularPass>
< nosuffix> true< / nosuffix>
< webappTargetDir> $ {project.build.directory}< / webappTargetDir>
< jsSourceIncludes>
< jsSourceInclude> ** / *。js< / jsSourceInclude>
< / jsSourceIncludes>
< / configuration>
< / execution>
< / executions>
< / plugin>


解决方案

为什么不使用Sencha Cmd?它完全符合您的要求!



如果您知道您可以在没有Sencha应用程序结构的情况下使用Sencha Cmd,可能会有所帮助。如果您只想合并文件,请使用连接 cmd。



如果你真的不想使用Sencha Cmd,那么你必须照顾所有的扩展,需求,mixins等...我会不推荐这个!



例如,使用带有手动路径的Sencha Cmd,并排除extjs类

  sencha compile --classpath = myApp / src,extjs / src -debug = false exclude -all和include -namespace MyApp。*和concat bundle.js 
/ pre>

extjs / src路径是您的extjs类的路径


I have an existing ExtJS app developed using ExtJS 4.2.1. I am using Closure minifier through Maven plugin minify-maven-plugin. The generated minified JS files (without merge) works fine. However, generated merged minified file throws undefined errors because the definition comes later in the merged file. My question is, is there a way I can figure out the order I have to provide the plugin? (I don't want to use Sencha Cmd)

The app folder follows the structure

app/common, app/controller, app/model, app/proxy, app/store, app/utils, app/view

At the moment this is how I have defined the build process in Maven POM file

<plugins>
        <plugin>
            <groupId>com.samaxes.maven</groupId>
            <artifactId>minify-maven-plugin</artifactId>
            <version>1.7.4</version>
            <executions>
                <execution>
                    <id>default-minify</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>minify</goal>
                    </goals>
                    <inherited>false</inherited>
                    <configuration>
                        <charset>UTF-8</charset>
                        <!--  <skipMerge>true</skipMerge> -->
                        <webappSourceDir>${basedir}/src/main</webappSourceDir>
                        <jsSourceDir>js/app</jsSourceDir>
                        <jsTargetDir>js/app</jsTargetDir>
                        <jsEngine>CLOSURE</jsEngine>
                        <closureLanguage>ECMASCRIPT5</closureLanguage>
                        <closureAngularPass>true</closureAngularPass>
                        <nosuffix>true</nosuffix>
                        <webappTargetDir>${project.build.directory}</webappTargetDir>
                        <jsSourceIncludes>
                            <jsSourceInclude>**/*.js</jsSourceInclude>
                        </jsSourceIncludes>
                    </configuration>
                </execution>
            </executions>
        </plugin>

解决方案

Why dont use Sencha Cmd? It does exactly what you want!

Maybe it helps if you know that you can use Sencha Cmd without the Sencha application structure. If you want only merge the files use the concatenate cmd.

If you really dont want use Sencha Cmd, then you have to take care of all the extends, requires, mixins and so on... and I would not recommend this!

For example use Sencha Cmd with manual paths and exclude the extjs classes

sencha compile --classpath=myApp/src,extjs/src -debug=false exclude -all and include -namespace MyApp.* and concat bundle.js

the extjs/src path is the path where your extjs classes are

这篇关于是否有办法在没有Sencha CMD的情况下缩小ExtJS应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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