drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
423 stars 122 forks source link

Simplify instructions in the README.md #83

Open musically-ut opened 9 years ago

musically-ut commented 9 years ago

Since version 0.7.1, grunt-contrib-connect passes middlewares array to the middleware option's function. This array can be modified to change the middleware stack instead of hand-picking which middlewares to retain.

Hence, if we add a peerDependency on grunt-contrib-connect at version 0.7.1, then we can just use the following as the installation instructions:

connect: {
    livereload: { // or "server" task
        options: {
            middleware: function (connect, options) {
                middlewares.unshift(require('grunt-connect-proxy/lib/utils').proxyRequest);
                return middlewares;
            }
        }
    }
}

Otherwise, the complicated instructions lead to confusion in how to use the grunt-connect plugins.

EricWVGG commented 9 years ago

I did not find the instructions very clear either.

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: grunt.loadNpmTasks('grunt-connect-proxy');

That should probably read "Once". It doesn't say where in the Gruntfile this command goes. And anyway it doesn't even seem necessary.

“You must specify the connect target in the configureProxies task.”

huh?

Regardless, it does appear to work perfectly once installed. Thank you for making and maintaining this tool.