EE 템플릿 시스템에서 생성 된 여분의 공백을 제거하고 "더 예쁜"마크 업을 생성하는 방법이 있는지 궁금합니다.ExpressionEngine 템플릿에서 공백 제거
나는 템플릿을 읽을 수있게 유지하려고합니다. 나는 종종 일 년 후에 일자리로 돌아가거나, 다른 개발자의 일을 따르거나, 팀의 일원으로 일해야하며, 모든 것이 깔끔하고 중첩 될 때 더 쉽습니다.
EE는 모든 탭과 줄 바꿈을 유지하며 많은 조건문이있을 때 코드가 엉망이됩니다. 예를 들어,이 :
<div class="
event {if event_all_day}all_day{/if}
{if event_multi_day}multi_day{/if}
{if event_first_day}first_day{/if}
{if event_last_day}last_day{/if}
{if all_day_event_index_difference > 0}index_difference_{all_day_event_index_difference}{/if}
">
{if event_multi_day}
<a href="{path='calendar_main/event'}/{event_id}/">{event_title}</a>
{if:else}
<a href="{path='calendar_main/event'}/{if edited_occurrence}{event_parent_id}{if:else}{event_id}{/if}/" title="{event_title}">{event_title}</a>
{/if}
</div>
이로 렌더링 :
<div class="
event all_day
multi_day
">
<a href="http://www.downtownmuncie.org/calendar_main/event/1832/">Minnetrista Glass Show</a>
</div>
모든 탭과 EE 태그를 둘러싼 라인 브레이크는 보존됩니다, 그래서 나는 <div>
사이의 공백 마일과 바람 </div>
.
성능면에서는 의미가 없습니다. 파일 크기가 커지면 인수가있을 수 있지만 무시해도됩니다. Firebug를 사용하여 코드를 탐색하려고 할 때도 약간의 방해가됩니다.
그러나 무엇보다도, 그것은 단지 엉성한 것처럼 보입니다.
한 가지 제안과 같이, 그에 따라 템플릿을 조정하는 것입니다
정말 실행 가능한 해결책이 아니다<div class="event {if event_all_day}all_day {/if}{if event_multi_day}multi_day {/if}{if event_first_day}first_day {/if}{if event_last_day}last_day {/if}{if all_day_event_index_difference > 0} index_difference_{all_day_event_index_difference}{/if}">
{if event_multi_day}<a href="{path='calendar_main/event'}/{event_id}/">{event_title}</a>{if:else}<a href="{path='calendar_main/event'}/{if edited_occurrence}{event_parent_id}{if:else}{event_id}{/if}/" title="{event_title}">{event_title}</a>{/if}
</div>
. 깔끔한 템플릿과 깔끔한 코드 사이의 선택을 감안할 때, 나는 이전과 같이 가야 할 것입니다.
두 가지 방법이 있습니까?
ty