Hi,
I have a common piece of code in sightly html ,instead of writing the repetitive code can i put this in a different file and just invoke are there any other ways . Please suggest.
In /apps/project/testcomponent/testcomponent.html
in the testcomponent.html:-
<sly data-sly-use.a="com.project.abc">
<!-- /* with brand */ -->
<sly data-sly-test="${a.brandStyles == 'brand'}">
<div class="comon1"> dd </div>
<div class="comon2"> cc </div>
<div class="comon3"> ff </div>
...
</sly>
<!-- /* without brand */ -->
<sly data-sly-test="${a.brandStyles != 'brand'}">
<div class="comon1"> dd </div>
<div class="comon2"> cc </div>
<div class="comon3"> ff </div>
...
</sly>
I tried:-
To put this file in file in /apps/project/testcomponent/abc.html
so abc.html had:-
<div class="comon1"> dd </div>
<div class="comon2"> cc </div>
<div class="comon3"> ff </div>
Now i modified in testcomponent.html:-
<sly data-sly-use.a="com.project.abc">
<!-- /* with brand */ -->
<sly data-sly-test="${a.brandStyles == 'brand'}">
<sly data-sly-include="/apps/project/testcomponent/abc.html"/>
...
</sly>
<!-- /* without brand */ -->
<sly data-sly-test="${a.brandStyles != 'brand'}">
<sly data-sly-include="/apps/project/testcomponent/abc.html"/>
...
</sly>
This throws error while page render
Please suggest how to solve this problem
Thanks