Previewing theme changes locally

Return to top

16 Comments

  • Paolo
    Zendesk Engineering
    Hi Nico,
     
    Are you adding the theme directory to the command? I have found this documentation that might help: https://github.com/zendesk/zcli/blob/master/docs/themes.md
    1
  • Adrian Martin

    The "TypeError: Cannot read properties of undefined (reading 'split')" in Windows environment is caused by a bug with the templates' detection.

    I fixed it after changing the next line in node_modules\@zendesk\zcli\node_modules\@zendesk\zcli-themes\dist\lib\getTemplates.js

    const identifier = template.split('templates\\')[1].split('.hbs')[0].replace(/\\/g, '/');

    @zendesk/zcli/1.0.0-beta.38 win32-x64 node-v16.13.2

    1
  • Nico Plinke

    Hi,

    I'm following the guide, however, when I want to start the background process (zcli themes:preview) I get an error: TypeError: Cannot read properties of undefined (reading 'split')
    I've tried to delete all .split(), but to no success

    It happens on every theme (e.g. the copenhagen base theme)

    Any ideas how to fix this?

    1
  • Nico Plinke

    Thanks for your reply Paolo.

    Your solution worked, unfortunately only half...
    When I try to preview my reworked theme (we have a theme made for us by an external company), I get a version of it with a lot of issues (everything is crammed to the left, lots of errors in the javascript, etc...)
    I tried going back to basics, and downloaded the original copenhagen theme. 
    When I try to preview that, I get a 503: service unavailable.

    Does any of this sound familiar?

    My frontend-dev is now doing all the changes in the integrated zendesk filereader, but that really is not workable.

    Thanks for the help!

    1
  • Peter Piek

    I think it is nice to mention that themeId used in some zcli themes commands can be found through: https://{subdomain}.zendesk.com/api/v2/guide/theming/themes

    Then look for the id of the theme in the JSON response.

    See also: https://developer.zendesk.com/api-reference/help_center/help-center-api/theming/

     

    1
  • Peter Piek

    Jared What are your results from running these commands:

    $ zcli profiles:list
     Subdomains            
     ───────────────────── 
     <YOUR-SUBDOMAIN> <= active 
    $ echo $ZENDESK_SUBDOMAIN
    <YOUR-SUBDOMAIN>
    0
  • Henrik Eijsink

    to avoid the .split error. Please change two commands in this tutorial:

    cd guide_themes/newlook_theme

    should be 

    cd guide_themes

    and 

    zcli themes:preview 

    should be

    zcli themes:preview 'newlook_theme'
    0
  • Albin Nilsson af Sillén

    Hi all

    Am alo stuck on this,
    Have done the:
     profiles:list
     Subdomains

    Where I got my subdomain.

    Am able to log in using the SSO approach with /token. 

    My code that I work with is a clone of the github Copenhagen repo https://github.com/zendesk/copenhagen_theme

    Did also add the the new line as Adrian Martin mentioned above.






    0
  • Charles Nadeau
    Zendesk Documentation Team

    Excellent idea, Hamish. I added the following info in the bit about signing in:

    Use your account's standard Zendesk subdomain to sign in. Don't use any host mapped subdomain.

    0
  • Hamish Lang

    For ZCLI, should the sub-domain be the un-host mapped URL? I've tried logging in using the host mapped one but didn't work, reverting to the .zendesk URL worked though. Might be worth adding to the article for dummies like me if that's the case.

    In ZAT previously you could use the host mapped URL for the preview. 

    0
  • Tina Pham

    I also get this error when trying to run zcli themes:preview:
    TypeError: Cannot read properties of undefined (reading 'split')

    I tried adding the theme directory to the command, but got the same error as without it. 

    0
  • Joshua Lopez

    Hello Adrian, I tried your method but I am still getting the error (reading 'split')

    Has anyone found a solution? 

    0
  • Diego Hernandez

    The ZCLI is an improvement to the previous options, thanks for that.

    What I am currently not achieving:

    • theme assets are not displayed. Inspecting them in the DOM tree does not show any network errors but the URL begins with $assets - so this mean a specific URL is not generated. I thought this might related to the mixed contents topic discussed here: https://github.com/zendesk/zcli/blob/master/docs/themes.md  but it seems that running the theme:preview command with added certificate parameters does not make any difference
    • Dynamic contents are also not loaded, the Preview loads instead "could not find placeholder for dynamic content *name of dynamic content" messages. I could not find any info on the documentation / KB articles.

    thank you,
    /Diego

    0
  • Jared

    Hi,

    I've followed the install & setup here. I'm running zcli themes:preview (I'm inside the working directory) logging in using environment variables (WSL) and it seems to be uploading the theme but I'm getting the below:

    Uploading theme... Ok
    /usr/local/lib/node_modules/@zendesk/zcli/node_modules/@zendesk/zcli-themes/dist/commands/themes/preview.js:52
                const { subdomain, domain } = await new zcli_core_1.Auth().getLoggedInProfile();
                        ^

    TypeError: Cannot destructure property 'subdomain' of '(intermediate value)' as it is undefined.
        at Server.<anonymous> (/usr/local/lib/node_modules/@zendesk/zcli/node_modules/@zendesk/zcli-themes/dist/commands/themes/preview.js:52:21)

    Any help would be appreciated.

    0
  • Rajan

    Ryan McGrew I am getting an error on zcli login -i.
    NOTE: I have stored the env variables in ~/.zshrc file.


    0
  • Jared

    Thanks for the reply Peter, I've run into more issues that make me wonder if it's my WSL that's causing the problem, I'm going to retry on a clean machine and see if the problem goes away. I'll come back if I'm still having problems.

    0

Please sign in to leave a comment.

Powered by Zendesk