mardi 9 septembre 2014

Referencing resources from packages in dev mode

I have an Ext.JS 5 app in a workspace, which "requires" a local package from the same workspace. The package contains some images under its resources folder.

Running 'sencha app build' or 'sencha app watch' merges the resources folder from the package into "<workspaceDir>/build/development/<appName>/resources/<pkgName>", but not "<appDir>/resources/<pkgName>", as I would expect, in order for the files to be available alongside the app source in dev mode.


I'm using Ext.JS 5.0.1 and the just-released Sencha Cmd 5.0.2.270. although the same issue was present with Sencha Cmd 5.0.1.


Here are the steps to reproduce this scenario:



Code:



sencha -sdk <ext-5.0.1 sdk directory> generate workspace PkgTest

cd PkgTest


sencha -sdk ext generate app TestApp TestApp


sencha generate package TestPkg


cd TestApp


[ Edit app.json, add "TestPkg" to requires list ]


sencha app watch

Now add some images to PkgTest/packages/TestPkg/resources/images/. These are copied to PkgTest/build/development/TestApp/resources/TestPkg, but as mentioned above, I would expect them to be copied to PkgTest/TestApp/resources/, so that they are available to the app when loading the from index.html in dev mode (i.e. http://localhost:1841/TestApp/ )

As is, I cannot reference the resources in dev mode the same way I would in a production build.


It seems I either need to alter the directory the package resources are merged into, or have the built-in web server remap the resources directory.


What am I missing? If this is working as designed, what is the best practice for working with packages that contain resources in dev mode?


Thanks in advance for any tips.






Referencing resources from packages in dev mode

Aucun commentaire:

Enregistrer un commentaire