Warning: connect.static is not a function

grunt-contrib-connect从0.11.x版本开始不支持connect.static和connect.directory

你应该安装serve-static(加载静态文件)和serve-index(加载目录)

npm install --save-dev grunt-contrib-connect serve-static 

使用例子

var serveStatic = require('serve-static');
var serveIndex = require('serve-index');

grunt.initConfig({
connect: {
options: {
test: {
directory: 'somePath',
middleware: function(connect, options){
var _staticPath = path.resolve(options.directory);
return [serveStatic(_staticPath), serveIndex(_staticPath)]
}
}
}
}
})



参考链接http://*.com/questions/32961124/warning-connect-static-is-not-a-function-use-force-to-continue



上一篇:CF528D Fuzzy Search 和 BZOJ4259 残缺的字符串


下一篇:MongoDB入门系列(三):查询(SELECT)