티스토리 뷰
참고 : http://handlebarsjs.com/precompilation.html
1. install node, npm
<pre class="brush:html"> <link href="//home.tistory.com" rel="stylesheet" type="text/css"/> <script type="text/javascript"> var link_src = "jcdgods.tistory.com" </script> </pre>
|
2. install Handlebars npm package
|
3. 템플릿 작성
{{#if title}}<h5 class="hide">{{title}}</h5>{{/if}} <ul class="cfix"> {{#items}} <li> <div class="box_pd"> <a href="{{prdLink}}" onclick="ga('send', 'event', '중소세카테고리', '프리미엄코너', '');" data-prd-no="{{prdNo}}" data-minor-yn="{{minorYn}}" data-ad-trc-no="{{trcNo}}" data-ad-typ-gubn="{{typGubn}}" data-ad-area-gubn="{{areaGubn}}" data-ad-cpc-yn="{{cpcYn}}"> {{#if best}}<span class="order">{{best}}<span class="hide">위</span></span>{{/if}} <img src="{{prdImgThumb}}" alt="{{prdTitle}}" onerror="skp11.common.blankImage(this, 212);"/> <div class="pname"> <p>{{prdTitle}}</p> <div class="price_info mini"> <span class="price_detail"> <span class="hide">{{#if unitPrice}}{{unitPrice}}{{else}}판매가{{/if}}</span><strong class="sale_price">{{prdFinalPrice}}</strong>{{#if unitTxt}}{{unitTxt}}{{else}}원{{/if}} </span> </div> <div class="prd_flag"> {{#if myWayDscStr}}<em>{{myWayDscStr}}</em>{{/if}} <div class="s_flag"> {{#if freeDlv}}<em>{{freeDlv}}</em>{{/if}} {{#if nowDlv}}<em><em class="now_ico"><span class="hide">now배송</span></em></em>{{/if}} </div> </div> </div> </a> </div> </li> {{/items}} </ul> |
4. precompile - tpl 폴더 아래 템플릿 파일들을 컴파일하고 하나의 파일로 (template.js) 합쳐준다.
$ handlebars tpl/*.handlebars -f template.js |
5. precompiled template + handlebars 로 화면 그리기
|
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- #csvreader
- Python
- Big xml 파싱
- could not initialize proxy - no Session
- oracle12
- 단축키
- JPA 오류
- 계층형
- cloudsearch 비용
- iTerm
- tomcat
- OneToMany
- 서버 환경변수
- JPA
- JoinColumn
- org.hibernate.LazyInitializationException
- db connect
- StAX
- ojdbc7
- 엘라스틱서치
- Elasticsearch
- getdate
- aws cloudsearch
- CloudSearch
- timestamp
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함