1.1.1 • Published 9 years ago

koa-files-combiner v1.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

koa-files-combiner

A koa middleware for combining files.

Usage

var koa = require('koa')
var combine = require('koa-files-combiner')

var app = koa()
app.use(combine('path/to/static/files/root'))

app.listen(3000)

Then request the files bundle in browser:

http://localhost:3000/combine/js/global/libs.min.js,/bootstrap/bootstrap.min.js
                     /-------/--/------------------,/--------------------------
                        |     |         file1                 file2
                        |     |
                        |    type("js" or "css", for MIME)
                        |
                      use combine service

Options

app.use(combine('path/to/static/files/root', options))

which options could be:

{
  prePathParser: function(url) { /*...*/ return url },
  pathParser: function(url) { /*...*/ return filesObj },
  postPathParser: function(filesObj) { /*...*/ return filesObj }
}

the filesObj should be:

{
  type: 'js',
  files: ['path/to/file1.js', 'path/to/file2.js']
}
1.1.1

9 years ago

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago