Is there a way to minify an ExtJS application without Sencha CMD?

走远了吗. 提交于 2019-12-04 11:56:54

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

Since your question is about the order of of files for minification, providing that information below:

We had a similar requirement, where I could not use Sencha cmd as it is to minify files, so created jsb file on my own [I know this is not recommended :( ].

What I did was, created below jsb file [please note: sequence of files is very important]:

{
"projectName": "ProductName",
"builds": [
/** This file is for production purpose **/
    {
        "name": "ProductName - Production",
        "target": "all-app.js",
        "compress": true,
        "files": [
        /** utils **/

            {
                "path": "app/util/",
                "name": "util.js"
            }
        /** models **/
            {
                "path": "app/model/",
                "name": "MyModel.js"
            },
        /** stores **/
            {
                "path": "app/store/",
                "name": "MyStore.js"
            },

        /** custom components  **/

            {
                "path": "resources/ux/form/",
                "name": "MySearchField.js"
            },
        /** views **/
            {
                "path": "app/view/admin/",
                "name": "MyView.js"
            },
        /** controllers **/
         {
                "path": "app/controller/",
                "name": "Window.js"
         },
        /** app.js **/

         {
                "path": "",
                "name": "app.js"
         }
        ]
    },
    /** This file is for debug purpose **/
    {
        "name": "ProductName - debug",
        "target": "all-app-debug.js",
        "compress": false,
        "files": [
        /** utils **/

            {
                "path": "app/util/",
                "name": "util.js"
            }
        /** models **/
            {
                "path": "app/model/",
                "name": "MyModel.js"
            },
        /** stores **/
            {
                "path": "app/store/",
                "name": "MyStore.js"
            },

        /** custom components  **/

            {
                "path": "resources/ux/form/",
                "name": "MySearchField.js"
            },
        /** views **/
            {
                "path": "app/view/admin/",
                "name": "MyView.js"
            },
        /** controllers **/
         {
                "path": "app/controller/",
                "name": "Window.js"
         },
        /** app.js **/

         {
                "path": "",
                "name": "app.js"
         }
        ]
    }
],
"resources" : []

}

If you create a minified file using above sequence, it will work in your case as well.

Hope this help. Thanks!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!