Browse Source

switched from jade to swig, to use a proper extendable templating engine

master
Julio Biason 11 years ago
parent
commit
34caedf656
  1. 14
      lyricsnode/app.js
  2. 3
      lyricsnode/package.json
  3. 11
      lyricsnode/views/index.html
  4. 5
      lyricsnode/views/index.jade
  5. 7
      lyricsnode/views/layout.jade

14
lyricsnode/app.js

@ -7,14 +7,22 @@ var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
, path = require('path')
, cons = require('consolidate')
, swig = require('swig');
var app = express();
// all environments
app.engine('.html', cons.swig)
swig.init({
root: path.join(__dirname, 'views'),
allowErrors: true
})
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'html');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());

3
lyricsnode/package.json

@ -7,6 +7,7 @@
},
"dependencies": {
"express": "3.3.4",
"jade": "*"
"consolidate": "*",
"swig": "*"
}
}

11
lyricsnode/views/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
Hello from {{ title }}
</body>
</html>

5
lyricsnode/views/index.jade

@ -1,5 +0,0 @@
extends layout
block content
h1= title
p Welcome to #{title}

7
lyricsnode/views/layout.jade

@ -1,7 +0,0 @@
doctype 5
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
Loading…
Cancel
Save