Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-preprocess

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-preprocess

flexible preprocessor middleware for connect / express.

  • 1.0.0
  • beta
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

connect-preprocess

flexible preprocessor middleware for connect / express.

Installation

npm install connect-preprocess

Basic Use

var connect = require( 'connect' );
var Preprocessor = require( 'connect-preprocess' );
var engine = require( 'some-preprocessor-engine' );

var server = connect.createServer();
server.use( Preprocessor({ engine: engine }));

Options

ParameterTypeDescriptionDefault
acceptArrayFile types to preprocess[ 'html' , 'css' , 'js' ]
engineFunctionThe preprocessor enginefunction(str){return str}

Examples

grunt connect plugin

  • Gruntfile.js
    var Preprocessor = require( 'connect-preprocess' );
    
    grunt.initConfig({
      // ...
      connect: {
        options: { port: 9000 },
        server: {
          options: {
            middleware: function ( connect , options , middlewares ) {
              middlewares.unshift( Preprocessor({ engine: grunt.config.process }));
              return middlewares;
            }
          }
        }
      },
      // ...
    });
    
  • example.html
    <!DOCTYPE HTML>
    <html>
    <head>
        <title><%= pkg.name %></title>
        <script src="<%= pkg.main %>"></script>
    </head>
    <body>
        <a href="<%= pkg.homepage %>">visit the homepage!</a>
    </body>
    </html>
    
  • result
    <!DOCTYPE HTML>
    <html>
    <head>
        <title>connect-preprocess</title>
        <script src="index.js"></script>
    </head>
    <body>
        <a href="https://github.com/elnarddogg/connect-preprocess">visit the homepage!</a>
    </body>
    </html>
    

Keywords

FAQs

Package last updated on 20 Nov 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc