📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

gulp-respond

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-respond

Send file stream into http server response.

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

gulp-respond

Send file stream into http server response.

Usage

First, install gulp-respond as a development dependency:

npm install --save-dev gulp-respond

Then, add it to your gulpfile.js:

var replace = require('gulp-respond');
var connect = require('gulp-connect');

gulp.task('connect', 'Start server using a middleware', function () {
    connect.server({
        root: 'app',
        port: 8080,
        middleware: function () {
            return [function (req, res, next) {
                var url = req.url.split('?').shift();
                gulp.src('src' + url) // load file of an different folder than the root one
                    .pipe(parse()) // do any content modifications
                    .pipe(respond(res)); // push the modified content directly to the response
            }];
        }
    });
});

Keywords

gulp

FAQs

Package last updated on 18 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts