combo-server

2.1.4 • Public • Published

Build Status

combo-server

Express and connect middleware to combo static assets.

Install

$ npm install combo-server --save

Usage

var config = {
  routes: [
    {
      location: '/mod',
      root: '/data/static'
    }
  ],
 
  // Optional
  // If the pathname of the url doesn't start with '/combo/',
  // it will skip and go to the next middleware
  base: '/combo',
 
  // Default root to find static files, can be a path string or array of strings
  root: [
    '/data/old-static'
  ],
 
  // disable cache
  cache: false
}
 
var app = require('express')()
var middleware = require('combo-server')(config)
app.use(middleware)
app.listen(8888)

By default, when visiting:

http://localhost:8888/combo/mod/a.js,mod/b.js

It will returns the comboed content of '/data/static/a.js' and '/data/static/b.js'.

  • config Object
    • path_parser function(url, config)
    • joiner function(contents)
    • cache false|Object set to false to disable cache, or the async-cache options

path_parser

Returns Array.<pathname>

Package Sidebar

Install

npm i combo-server

Weekly Downloads

3

Version

2.1.4

License

MIT

Last publish

Collaborators

  • kael