1. #1
    Ext JS Premium Member Ron Howard's Avatar
    Join Date
    May 2011
    Posts
    115
    Vote Rating
    3
    Ron Howard is on a distinguished road

      0  

    Default Guide for making a custom starter template...

    Guide for making a custom starter template...


    Is there any guides on starter templates?

    I've started toying around with the sencha command and using my own starter template.

    And I wanted to know if there is some hidden features we can use with sencha command to make our templates more flexible to what we need.

    Thanks,
    Ron

  2. #2
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    418
    Vote Rating
    61
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    The starter templates use the x-generate Ant command under-the-hood, so in your template you should be able to use any of the x-generate features, which you can read about here. The main feature of course, is that files with a ".tpl" extension are rendered using the XTemplate engine. You can then use any of the parameters supplied by Sencha Cmd inside your template files. I'm not using the latest version of Sencha Cmd, but here's the available parameters for Sencha Cmd 3.1.2:

    Code:
    <param name="name" value="${args.name}"/>
    <param name="appName" value="${args.name}"/>
    <param name="library" value="all"/>
    <!-- These are needed for the theme template-->
    <param name="themeName" value="${args.themeName}"/>
    <param name="controllerName" value="${args.controllerName}"/>
    <param name="controllerFileName" value="${args.controllerName}"/>
    <param name="viewName" value="${args.viewName}"/>
    <param name="viewFileName" value="${args.viewName}"/>
    <param name="frameworkName" value="${framework.name}"/>
    <param name="frameworkPath" value="${framework.path}"/>
    <param name="packagesRelPath" value="${packages.extract.path}"/>
    <param name="senchadir" value="${senchadir}"/>
    <param name="uniqueId" value="${app.id}"/>
    <!-- placeholders for mvc structures -->
    <param name="appModels" value=""/>
    <param name="appViews" value=""/>
    <param name="appControllers" value=""/>
    <param name="appStores" value=""/>
    <param name="controllerNamespace" value="${args.name}.controller"/>
    <param name="modelNamespace" value="${args.name}.model"/>
    <param name="viewNamespace" value="${args.name}.view"/>

  3. #3
    Ext JS Premium Member Ron Howard's Avatar
    Join Date
    May 2011
    Posts
    115
    Vote Rating
    3
    Ron Howard is on a distinguished road

      0  

    Default


    @burnnat: Thanks for the reply but I'm using Sencha Command 4.0.1 and started making my own template folder with needed skeleton files.


    I'm using Sencha Command 4.0.1 with Ext JS 4.2.2.
    I'd like to make a template for our other developers at my company with a mix of our architecture code and Ext JS 4.2.2 that follows the sencha generate app structure for app building purposes.

    I couldn't find much about them other than what I've been toying around with.

    Thanks,
    Ron

  4. #4
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    418
    Vote Rating
    61
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Everything I've said should apply to Sencha Cmd 4.0 as well as 3.1. I just checked against a copy of Sencha Cmd 4.0 and the list of available template parameters is the same as what I've listed above. Assuming you're using something like sencha generate app --starter path/to/template to perform the generation, you should be able to use any or all of these parameters in your template.

  5. #5
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    927
    Vote Rating
    48
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Hi,


    Wondering if you got anywhere with this?


    Am wondering how the files are structured under the starter path, I'm guessing it's an app.js.tpl at least?
    It is possible to alter the templates for controllers, views, models etc, perhaps by adding some sub-directories containing them?

    Looking at those variables, I still think I'm going to need some manual updating, since I want to add a "namespaces" value to my generate application.

    Cheers,
    Westy
    Product Architect
    Altus Ltd.

  6. #6
    Ext JS Premium Member Ron Howard's Avatar
    Join Date
    May 2011
    Posts
    115
    Vote Rating
    3
    Ron Howard is on a distinguished road

      0  

    Default


    We have been able to customize packages so it auto creates our template for us.
    We aren't using app's because of how much views we have we are sharing common files and not doing the app build all in one js file.

    Inside the Sencha CMD install directory you will see templates which has the app's {senchadir} folder that tells sencha command to change that folder name to .sencha.

    If you want to make a custom app look inside the plugins folder in the sencha cmd install directory.
    We are using Ext JS so the folder is ext. You can setup any template changes you want there.

    For packages everything needed is under the templates folder the package folder will let you do custom lines in the sencha.cfg and the starter-package folder is the skeleton for any package we have customized a lot in here for our needs.

    Just make sure if you add any files you follow the naming scheme. {pkgName}-app.js.tpl.merge will let the parser know to change any variables with { } around them to the value they are set to.

    Let me know if you have any other questions.

  7. #7
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    927
    Vote Rating
    48
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Ahh, I see. I was looking for templates under Ext somewhere, but they're in Cmd.
    That makes sense I suppose.

    Thanks for the pointers, I'll have a poke around.
    Product Architect
    Altus Ltd.

Thread Participants: 2