Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
Created January 10, 2023 23:53
Show Gist options
  • Select an option

  • Save dstyle0210/222d9daa12ec20e83d0c8e076192c994 to your computer and use it in GitHub Desktop.

Select an option

Save dstyle0210/222d9daa12ec20e83d0c8e076192c994 to your computer and use it in GitHub Desktop.
EJS 기초 API (?) 메모장
<%
const 변수1 = "변수값"; // 그냥 선언하기
// {string} 상수2 : 상수설명
const 상수2 = locals.상수2; // include options 로 땡겨올때 필수값
// {"변수옵션값1"|"변수옵션값2"} [변수3 = "변수옵션값1"] : 변수설명
let 변수3 = locals.변수3 ? locals.변수3 : "변수옵션값1"; // include options 로 땡겨올때 옵션값
const { 상수4 , 상수5 = "변수값" } = locals; // 객체분해할당 으로 include options 땡겨옴(이게 젤 많이 씀, 간단하니까)
%>
값뿌리기(jsp와 동일)
<%= 변수1 %>
if else (jsp와 동일)
<%if(){%><%}else{%><%}%>
인클루드
<%
const options = {옵션키:"옵션값",옵션키1:"옵션값1",옵션키2:"옵션값2"};
%>
<%-include("경로명",options)%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment