nodejs doctype과 # . 사용법
var http =require('http');
var jade= require('jade');
var fs=require('fs');
http.createServer(function(request , response){
fs.readFile('jadepage2.jade','utf8', function(error,data){
var fn=jade.compile(data);
response.writeHead(200,{'Content-Type':'text/html'});
response.end(fn());
});
}).listen(52775 , function(){
console.log('server runnig at http://127.0.0.1:52775');
});
jade 파일
doctype 5는 이젠 안쓴다
#header 는 div id header로 인식
.article은 div class article로 인식
html 파일에서 doctype을 해주는 이유는 html 버젼별로 태그가 다르기 때문에 어떤 html 버젼을 쓸지 선언을 해주는것이다
doctype html
html
head
title index page
body
//jade string
#header
h1 hello jade!!!
h2 lorem ipsum
hr
.article
a(href="http://hanb.co.kr") go to hanbit media
결과 값