Open mantaroh opened 1 year ago
@mantaroh san
Also we need to add the CMS's identification in case the user edit some content, for example on this file if the user updates the content of body_article
we could trigger an CMS update.
<article class="flex column gap-10" cms-item cms-content-type="article" cms-content="c-xxx">
<div class="flex gap-8">
<a class="blog-contentCard" href="#">
...
<div cms-item cms-content-type="article" cms-content="c-xxx" cms-field="article_body">
Some content
</div>
</a>
</div>
</article>
@yoannes
As we talked with, we need to add the CMS's field identifier into generated result like the following:
<div data-spear-content-type="news" data-spear-content="cr-XXXXX">
<p data-spear-content-field="title">News Title 1</p>
<p data-spear-content-field="body">This is news content.</p>
</div>
However, embed syntax can be wrote text node like bellow:
<div>
<p> Title is {%= news_title %} </p>
</div>
In above case, Title is {%= news_title %}
is text node of parent <p>
element. So we cannot insert data-spear-content-field
into this text node.
So we decided that spear wrap the embed syntax by <span>
tag like bellow:
<div>
<p>Title is <span>News title 1</span></p>
</div>
As discussed with you, we might drop this debug information when field type is calender and image.
If we inject the debug attribute these field type, the generated HTML will be like the bellow:
<div>
<img src="<span data-spear-field-type="image">https://www.xxxxx.xxxx/images/abc.png</span>">
</div>
The original source file is the following file:
<div>
<img src="{%= news_image %}">
</div>
User expect that this syntax might not replace injected debug data string. i.e., expecting url resource string.
So I decided that spear will inject debug information parent element when field type is image
and calendar
.
Spear ending up generate the following html by using an above sample:
<div>
<img src="https://xxxxx.xxxx/abc.png" data-spear-field-type="image">
</div>
This is little tricky, however this is the choice which we can inject debug information, I think.
@yoannes How do you think this injecting debug information mechanism of image and calendar type ? 🤔
@mantaroh It works fine for me. It will be good to search and replace the url when needed 🚀
What is this ?
This feature is:
If we have the following files:
index.html
components/main-component.spear
components/sub-component.spear
Spear will generate the following file with debug information
Usecase
I guess this feature help the bellow use-cases: