Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Luís Brás 3 posts 83 karma points
    Dec 06, 2021 @ 12:25
    Luís Brás
    0

    Exporter Sync-Pack and templates

    Hi!

    We're using uSync.Complete v8.9.3 and our current workflow is like this:

    1. We deploy the files to the target server

    2. Using uSync Exporter, we manually create a sync-pack for the document types we want to update, checking Dependencies, Children, and Ancestors, and import it on the target server

    Everything works as expected, except for templates. If a docType has a new template, it fails to import the template with the message "Cannot find Template".

    I understand the templates exist on disk, but not on Umbraco database. We then have to manually add the template in Umbraco Backoffice and change the allowed / default templates of the imported docTypes.

    If I check the "Include template files" checkbox, the *.cshtml files from the /Views folder are included, but they're not added to the DB.

    I was under impression that uSync has the ability to add the templates reference to the DB, provided they exist on the disk. Is this true? If so, what am I doing wrong?

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Dec 06, 2021 @ 12:41
    Kevin Jump
    0

    Hi Luis,

    Yes that should work, only really seen issues if the templates folder has been moved somehow.

    I would recommend you update to the latest version and see if that helps. because with v8.10+ you can actually pick templates in the exporter and it will include them individually just like we do doc-types.

    Kevin

  • Luís Brás 3 posts 83 karma points
    Dec 07, 2021 @ 17:05
    Luís Brás
    0

    Hi Kevin, thanks for the quick answer.

    I upgraded to the latest 8.x uSync version, but it turns out the templateHandler for the exporter was not enabled in my uSync.config. With the handler enabled the templates are correctly restored, as long as I include them when creating the sync-pack.

    When templates are not included, it fails to find the referenced templates, although they exist on the server.

    My incorrect assumption was that when importing a sync-pack containing only docTypes and dataTypes uSync would try to find missing templates referenced by the docType in the server /views folder, looking for *.cshtml files with a name that matched the template alias.

    I guess I was expecting that when docType dependencies are included the template xml would also be exported to the sync-pack.

    So the only option is to include the templates, but that also means folders /views, /scripts and /css will be overwritten with the ones from the sync-pack, right? Even if they're unrelated to the exported docType.

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Dec 07, 2021 @ 20:13
    Kevin Jump
    100

    Hi Luis,

    yeah your right, the templates (and the files) don't get included in the sync pack unless the include templates button is clicked and then everything (views, css, scripts) is included.

    I think we did it this way because we are not doing dependency checking within the code, so we don't for example know if the template file requires a certain set of partial views, or indeed if there are also scripts and css files that will be needed for the template to work. So we went everything or nothing.

    With the current release I think we can be a little more nuanced than that, we still don't do code dependency checking but with the advent of the file sync items we decided it wasn't our call to make, so we have been putting warning around file syncs along the lines of , you have to make sure you know what other code files are required.

    This is something we should extend to Exporter, we will take a look at making this more granular for the next release.

Please Sign in or register to post replies

Write your reply to:

Draft