express-ejs-layout 활용하기
layout 사용하기
const layout = require('express-ejs-layouts'); app.use(layout); app.set('layout', 'layout/layout');<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <%- navbar %> <%- body %> <%- footer %> </body> </html><%- contentFor('navbar') %> <p> this is navbar!! </p> <%- contentFor('body') %> <p> this is body~ </p> <%- contentFor('footer') %> <p> this is footer... </p>
한발자국 더 나가기
defineContent 선택적으로 ejs 파일 적용하기
script 를 넣어주는 방법
해결
style 을 넣어주는 방법
두 개 이상의 레이아웃 사용하기
Last updated