4 Mar 2013 6:21 AM #1
Sencha Cmd 3.x and Rails
Sencha Cmd 3.x and Rails
I am trying to migrate from the Sencha SDK to the new Sencha Cmd 3 and I am having some trouble. Is there a good how-to, how to set up a the Sencha Ext Cmd for a Rails application?
I got the overall transition done. So all the js files should be in the right place it all compiles/builds fine using the default index.html. Now the "real" entry page of course is served by the rails server from a very different directory. I tried to use the compile page command instead on the index.html.erb file, but that raises errors because then the js sources are not in the right spot anymore ..
The second thing I am wondering about is the best spot where to put the files (directory wise) .. now all the ext src files as well as the app/ folder are in the rails public/ folder. That works fine, but is sort of against the idea of having a dedicated production build.
I was wondering if there is a good way to do, a best practice if you will.
Thanks for the help.
6 Mar 2013 2:45 AM #2
I think I figured out most of my problems, so I thought I'll post my lessons-learnd here real quick.
Basically I gave up on trying to have the sencha cmd compile the real index.html.erb file, that is used to generate the page and went with having a dummy sencha.hmtl in the public/ folder. Of course keeping both in sync is manual work, but shouldn't be to hard as this part of the setup rarely changes.
I then edited then .sencha/app/build-impl.xml so the build process looks for the sencha.html rather then index.html (property app.page.name). I also adjusted the build output directory to be just build/ (property build.dir in .sencha/app/build-impl.xml and workspace.build.dir in .sencha/workspace/sencha.cfg).
Now the sencha app refresh/build work fine.
In the rails index.html.erb I adjusted the JS files to be loaded depending on the current environment (if Rails.env.development?) following the sencha.html and the build/sencha.html files.
The themes also compile fine now, we use a custom .scss file based on the gray theme. Only issue I couldn't get done was to get the compiler to use the gray images. In the end I renamed the image src folders which I am not proud of :-)
Only open issue right now is that some of the source files are not included in the all-classes.js, which is probably due to a custom Ext extension we are using .. but I am going to open a separate thread for that question.