Skip to main content
edited title
Link
Mark Cassidy
  • 25.4k
  • 7
  • 59
  • 117

Sitecore JSS - do Do not create rendering for a template during jss deploy

Source Link
NewbieHere
  • 629
  • 4
  • 18

Sitecore JSS - do not create rendering for a template during jss deploy

I am using Sitecore 9.3 Instance with JSS.

I need to create a component that consists of 2 templates - say - Template1.sitecore.js and Template2.sitecore.js and 1 rendering - RenderingName/index.js.

So that, when I deploy it using jss deploy app command, only one json rendering is created in sitecore/Layouts/Renderings/ folder.

I am able to achieve it in Sitecore 9.2 by adding parameter - createRendering : false in Template2.sitecore.js, so that it does not create a component corresponding to that one. See code below -

import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';

export default function(manifest) {
  manifest.addComponent({
    name: 'Template2',
    icon: SitecoreIcon.DocumentTag,
    fields: [
    { name: 'title', type: CommonFieldTypes.SingleLineText,displayName:'Title' , section: 'Data' },
{ name: 'description', type: CommonFieldTypes.RichText,displayName:'Description' , section: 'Data' },
    ],
createRendering: false,

allowedPlaceholders: ['jss-main'],
  
  });
}

This worked for Sitecore 9.2 but when I use it in Sitecore 9.3, it creates a component for Template2.

Can anybody please suggest why it is not working in Sitecore 9.3 and how to resolve this?