使用CMD的Sencha 6 EXT JS Build - 错误的路径

问题描述 投票:0回答:1

Sencha 6.2 CMD Sencha EXT JS GPL 6+我的网络结构[服务器端]

- / public_html / affiliates - / app / sprinkles / tracker / assets / sencha [工作区文件夹 - 包含ext in / ext] - / app / sprinkles / tracker / assets / sencha / affiliates - 包含sencha app

从Web Side [浏览器]应用程序在http://localhost/affiliates时调用应用程序的路径是http://localhost/assets-raw/tracker/assets/sencha/affiliates

注意:http://localhost/assets-raw/tracker/assets/sencha/affiliates/index.html没有问题!

当我转到http://localhost/affiliates时,我得到了ext / classic的404错误(也许50个js无法加载)另外app / application.js无法加载

我需要能够将../assets-raw/tracker/assets/sencha/affiliates添加到生产构建路径中。

但是我发现区分路径网站以构建路径方面很困难。找不到会讨论这个问题的sencha文档(我已经通过文档很多了)

这是我的app.json配置https://gist.github.com/bobby5892/bf607a37c79a62820cf7fcaa245553c4

workspace.json config https://gist.github.com/bobby5892/689c54272ba49d63cb35b96f6a24266d

我如何初始化页面上的extjs

  <script type="text/javascript">
        var Ext = Ext || {}; // Ext namespace won't be defined yet...

        // This function is called by the Microloader after it has performed basic
        // device detection. The results are provided in the "tags" object. You can
        // use these tags here or even add custom tags. These can be used by platform
        // filters in your manifest or by platformConfig expressions in your app.
        //
      Ext.manifest = '../assets-raw/tracker/assets/sencha/affiliates/classic';

    </script>

    <!-- The line below must be kept intact for Sencha Cmd to build your application -->
    <script id="microloader" data-app="48a1b848-93ab-47fe-ba5a-a54e94f92ae5" type="text/javascript" src="/assets-raw/tracker/assets/sencha/affiliates/bootstrap.js"></script>

我该如何编辑该路径?

以下是app.json的相关部分(包含在该要点中)

   "production": {
        "frameworks": {        
                "ext": {
                    "path":"../assets-raw/tracker/assets/sencha/ext",
                    "version":"6.2.0.981"
                }
            },
         "output": 
        {
                "base": "${workspace.build.dir}/${build.environment}/${app.name}",
                "page": "../assets-raw/tracker/assets/sencha/affiliates/index.html",
                "manifest": "../assets-raw/tracker/assets/sencha/affiliates/${build.id}.json",
                "js": "../assets-raw/tracker/assets/sencha/affiliates/${build.id}/app.js",
                "appCache": {
                    "enable": false
                },
                "resources": {
                    "path": "${build.id}/resources",
                    "shared": "resources"
                }
        },
        "loader": {
            "cache": "${build.timestamp}"
        },
        "cache": {
            "enable": false
        },
        "compressor": {
            "type": "yui"
        },
        "manifest": {
           "embed": true
        }

我也正在通过sencha cmd进行构建

sencha app refresh
sencha app build

在此先感谢,已经花了很多时间来试图解决这个问题!

编辑:添加图像以显示与我需要的路径相对应的路径。

Paths

编辑:发现当sencha CMD生成构建时,classic.json中生成的路径是错误的。该文档说,在app.json中更改“page”的输出参数可能会起作用。我在构建的“生产”部分中有这个。还是行不通。 :(

json extjs build
1个回答
0
投票

关于sencha论坛的讨论结果取得了成功。 https://www.sencha.com/forum/showthread.php?469231-Sencha-6-EXT-JS-Build-using-CMD-wrong-paths

通过在从ajax调用检索之后但在ExtJS处理它们之前更改Ext.Manifest对象中的路径来解决此问题。

  <script type="text/javascript">
    ExtAbsoluteBasePath = "/assets-raw/tracker/assets/sencha/build/production/affiliates/";
    var Ext = Ext || {}; // Ext namespace won't be defined yet...

    // This function is called by the Microloader after it has performed basic
    // device detection. The results are provided in the "tags" object. You can
    // use these tags here or even add custom tags. These can be used by platform
    // filters in your manifest or by platformConfig expressions in your app.
    //
    Ext.beforeLoad = function (tags) {
        var s = location.search,  // the query string (ex "?foo=1&bar")
            profile;

        // For testing look for "?classic" or "?modern" in the URL to override
        // device detection default.
        //
        if (s.match(/\bclassic\b/)) {
            profile = 'classic';
        }
        else if (s.match(/\bmodern\b/)) {
            profile = 'modern';
        }
        else {
            profile = tags.desktop ? 'classic' : 'modern';
            //profile = tags.phone ? 'modern' : 'classic';
        }

        Ext.manifest = ExtAbsoluteBasePath + profile; // this name must match a build profile name

        // This function is called once the manifest is available but before
        // any data is pulled from it.
        //
        return function (manifest) {
            // peek at / modify the manifest object

            console.log(manifest);
            // Update JS Paths
            var i=0;
            manifest.js.forEach(function(jsPath) {
                console.log("\n Updating JS Path - " + jsPath.assetConfig.path + " to " + ExtAbsoluteBasePath + jsPath.assetConfig.path);
                manifest.js[i].assetConfig.path = ExtAbsoluteBasePath + jsPath.assetConfig.path;
                i++;
            });

            // Update CSS Paths
            i=0;
            manifest.css.forEach(function(cssPath) {
                console.log("\n Updating CSS Path - " + cssPath.assetConfig.path + " to " + ExtAbsoluteBasePath + cssPath.assetConfig.path);
                manifest.css[i].assetConfig.path = ExtAbsoluteBasePath + cssPath.assetConfig.path;
                i++;
            });


            //manifest.js["0"].assetConfig.path = ExtAbsoluteBasePath + manifest.js["0"].assetConfig.path;
            console.log("\n JS Path - " + manifest.js["0"].assetConfig.path);
        };
    };
</script>
© www.soinside.com 2019 - 2024. All rights reserved.