Authored by happyhour7

partials更新

1 var express = require('express'); 1 var express = require('express');
2 var path = require('path'); 2 var path = require('path');
3 -var ejs = require('hbs'); 3 +var hbs = require('hbs');
4 var favicon = require('serve-favicon'); 4 var favicon = require('serve-favicon');
5 var logger = require('morgan'); 5 var logger = require('morgan');
6 var cookieParser = require('cookie-parser'); 6 var cookieParser = require('cookie-parser');
@@ -9,17 +9,17 @@ var init=require('YJS'); @@ -9,17 +9,17 @@ var init=require('YJS');
9 var routes = require('./routes/index'); 9 var routes = require('./routes/index');
10 var users = require('./routes/users'); 10 var users = require('./routes/users');
11 var pjax = require('express-pjax'); 11 var pjax = require('express-pjax');
12 -var partials = require('express-partials'); 12 +//var partials = require('express-partials');
13 var app = express(); 13 var app = express();
14 14
15 // view engine setup 15 // view engine setup
16 app.set('views', path.join(__dirname, 'views')); 16 app.set('views', path.join(__dirname, 'views'));
17 -app.engine('html', ejs.__express); 17 +app.engine('html', hbs.__express);
18 app.set('view engine', 'html'); 18 app.set('view engine', 'html');
19 19
20 // uncomment after placing your favicon in /public 20 // uncomment after placing your favicon in /public
21 app.use(favicon(__dirname + '/public/favicon.ico')); 21 app.use(favicon(__dirname + '/public/favicon.ico'));
22 - 22 +hbs.registerPartials(__dirname + '/views/partials');
23 app.use(bodyParser.json()); 23 app.use(bodyParser.json());
24 24
25 app.use(bodyParser.urlencoded({ extended: false })); 25 app.use(bodyParser.urlencoded({ extended: false }));
  1 +这是girls的真正页面!!!!!!!!!!!!!!
1 -  
2 -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
3 -"http://www.w3.org/TR/html4/loose.dtd">  
4 -<html xmlns="http://www.w3.org/1999/xhtml">  
5 - <head>  
6 - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
7 - <title>New Web Project</title>  
8 - <link href="http://localhost/dist/css/todolist.css" rel="stylesheet" type="text/css"/>  
9 - <link rel="stylesheet" type="text/css" href="http://localhost/dist/css/login.css" />  
10 - </head>  
11 - <body>  
12 - <%-body%>  
13 - </body>  
14 -  
15 -</html>  
16 -  
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 </head> 9 </head>
10 <body> 10 <body>
11 {{{body}}} 11 {{{body}}}
12 - <script type="text/javascript" src="http://localhost:8000/dist/yohogirls-frontend-web/0.0.1/seajs.js?nowrap"></script>  
13 </body> 12 </body>
  13 + <script type="text/javascript" src="http://localhost:8000/dist/yohogirls-frontend-web/0.0.1/seajs.js?nowrap"></script>
  14 + {{>test}}
14 </html> 15 </html>
  1 +test.partials