Tag Archives: connect.static

[How to Solve]Warning: connect.static is not a function

grant contrib connect is not supported since version 0.11. X connect.static And connect.directory

you should install serve static (load static files) and serve index (load directory)

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

 

Examples

 

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)]
               }
            }
        }
    }
})


Reference link
http://stackoverflow.com/questions/32961124/warning-connect-static-is-not-a-function-use-force-to-continue