Authored by 周奇琪

Merge branch 'master' into develop

... ... @@ -82,9 +82,9 @@ gulp.task("clean",function(){
gulp.task("buildjs",["js"],function(){
gulp.src(path.join(public_dir,"dist") + '/*.js')
.pipe(uglify())
.pipe(rename({
suffix:md5
}))
// .pipe(rename({
// suffix:md5
// }))
.pipe(gulp.dest(dist_dir.js));
});
//发布静态资源
... ...
... ... @@ -10,6 +10,7 @@ var path = require('path');
var fs = require('fs');
var logger = console;
var config = require('../config/common');
var staticOptions = require('../staticConfig');
/**
* 模块名处理,根据环境设置模块名
... ... @@ -135,7 +136,17 @@ exports.deepSet = function (obj,key,cb) {
});
}
/**
* 获取API DOC配置
* @param {Object} routers 路由
*/
exports.getInterfaceConfig = function (routers) {
var env = process.env.NODE_ENV || 'development';
var cssFile = 'css/all.css';
if(env !== 'development') {
cssFile = staticOptions.staticDir[env]+'/all.css';
}
return function(req,res) {
if(req.query.key === config.apiKey) {
var groupList = [];
... ... @@ -160,7 +171,7 @@ exports.getInterfaceConfig = function (routers) {
navs[0].active = true;
groupList[0].active = true;
res.render('pages/apidoc/doc',{nav:navs,group:groupList,layout:false});
res.render('pages/apidoc/doc',{cssFile:cssFile,nav:navs,group:groupList,layout:false});
} else {
res.status(403).send('Permission denied');
}
... ...
... ... @@ -8,7 +8,7 @@
<title>YOHO!BUY API DOC</title>
<link href="css/all.css" rel="stylesheet">
<link href="{{cssFile}}" rel="stylesheet">
</head>
<body>
... ...