2015년 5월 21일 목요일

the "basedir" option is required to use "include" with "absolute" paths

  • 발생현상
.jade 파일에서 Style를 사용하기 위해서 style.css 파일을 include 한 것이 아래와 같은 오류 발생

Error: /Users/baesunghan/Documents/workspace/nodejs/reserveMovies/views/seats.jade:7
    5|           // link(rel='/stylesheets/stylesheet', href='my.css', type='text/css' )
    6|           style
  > 7|                include /stylesheets/style.css
    8|           script(src="http://code.jquery.com/jquery-1.10.2.js")
    9|           script(src="/socket.io/socket.io.js")
    10|           // 소켓 생성

the "basedir" option is required to use "include" with "absolute" paths



  • 발생원인
basedir가 지정되지 않아 발생함


  • 해결방법
방안 1) app.locals.basedir = app.get('views'); 추가
app를 선언한는  node.js 파일(일반적으로 app.js)에 app.locals.basedir를 추가한다.

방안 2) inlcude 를 사용하지 않고 link를 사용한다.
link(rel='stylesheet', href='/stylesheets/style.css', type='text/css' )
이 글은 Evernote에서 작성되었습니다. Evernote는 하나의 업무 공간입니다. Evernote를 다운로드하세요.

댓글 없음:

댓글 쓰기