gulp-file-include for, if 문 사용하기
@@include('./include/caseview.html',{
"item": [
{
"text": "테스트",
"func": "",
}
],
"popup": [
{
"popup": "#lifestyle-intro-layer",
"text":"설문 팝업 인트로",
},
{
"popup": "#lifestyle-layer",
"text":"설문 팝업",
},
{
"popup": "#custom-product-layer",
"text":"맞춤상품 팝업",
},
]
})
@@if (item) {
@@for(var i=0;i < item.length; i++){
<li class="case-view__item">
<a href="#" class="case-view__btn" onclick="`+item[i].func+`;return false;">`+(i+1)+`. `+item[i].text+`</a>
</li>
}
}
@@if (popup) {
@@for(var j=0;j< popup.length; j++){
<li class="case-view__item">
<a href="#" class="case-view__btn layer-popup-opener" data-layer-target="`+popup[j].popup+`">`+(j+1)+`. `+popup[j].text+`</a>
</li>
}
}
const fileIncludeConfig = {
"prefix": "@@",
"basepath": "@file",
"context": {
"type": "true",
"headerLeft": "",
"headerCenter": "",
"headerRight": "",
"title": "",
"text": "",
"bgClass": "",
"openStyle": "none",
"alertChk": "false",
"accChk": "false",
"disabled": "false",
"hideTitle": "false",
"hideSubBtn": "false",
"hideSubBtn2": "false",
"keypadClass": "",
"dscModifier": "",
"txMsg": "false",
"btnNormal": "true",
"hasDetail": "false",
"hasOption": "false",
"adjustGoal": "false",
"large": "",
"customTitle": "false",
"addClass": "",
"className": "",
"dontShowAgain": "false",
"subBtn2TextColor": "",
"btnBoxAlign": "",
}
};
function process_html() {
return src([
`${gulpConfig.src}/html/**/*.html`,
`!${gulpConfig.src}/html/**/@*`,
`!${gulpConfig.src}/html/includes/**/*`
])
.pipe($.fileInclude(fileIncludeConfig))
.pipe($.jsbeautifier({
config: '.jsbeautifyrc',
mode: 'VERIFY_AND_WRITE'
}))
.pipe(dest(`${gulpConfig.dist}/html`))
}