Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Unable to build the code- [WARNING] C:\Users\VACNIT\Desktop\Project Data\aem-sites\ui.apps\src\main\content\jcr_root\apps\SFEM\components\page\head.html [25:21]: ${properties.snippetheadstartcurall}: data-sly-test: redundant constant value compari

Avatar

Level 2
Here is my snippet. Unable to build the code due to redundancy warning. build fails. But code works fine in direct deployment
 
<sly data-sly-test=" ${properties.snippetheadstartcurall}">
 <sly> ${properties.snippetheadstartcurall @ context='unsafe'}</sly>
 </sly>
 <sly data-sly-test=" ${!properties.snippetheadstartcurall}">
   <sly>  ${inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}
   </sly>
 
Error info:
[WARNING] C:\Users\VACNIT\Desktop\Project Data\aem-sites\ui.apps\src\main\content\jcr_root\apps\SFEM\components\page\head.html [25:21]: ${properties.snippetheadstartcurall}: data-sly-test: redundant constant value comparison
[WARNING] C:\Users\VACNIT\Desktop\Project Data\aem-sites\ui.apps\src\main\content\jcr_root\apps\SFEM\components\page\head.html [28:22]: ${!properties.snippetheadstartcurall}: data-sly-test: redundant constant value comparison
please assist
1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @arjunsudhas1995 

 

You can try to modify this by using ternary operator like,

<sly>${properties.snippetheadstartcurall ? properties.snippetheadstartcurall : inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}</sly>

Hope it'd help!

View solution in original post

0 Replies

Avatar

Correct answer by
Level 3

Hi @arjunsudhas1995 

 

You can try to modify this by using ternary operator like,

<sly>${properties.snippetheadstartcurall ? properties.snippetheadstartcurall : inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}</sly>

Hope it'd help!

Avatar

Community Advisor
<sly data-sly-test.snippet=" ${properties.snippetheadstartcurall}" />
<sly data-sly-test="${snippet}"> ${snippet @ context='unsafe'}</sly>
<sly data-sly-test="${!snippet}">${inheritedPageProperties.snippetheadstartcurall @ context='unsafe'}</sly>

You can define a variable and reuse with data-sly-tes as well. 

 

You can use the solution suggested by @mayank0928