0.1.10 • Published 6 years ago

merco v0.1.10

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Build Status

Merco is Express middleware for merging and minifying JS files in run time. It also support cache busting.

How to use it ?

install merco module:

  • npm install merco

use merco as middleware:

  • app.use(merco.init(params));

set route from which you want to serve files:

  • app.get('/build/*', merco.route);

use it in template (.ejs):

<% getJS('PATH/TO/FILE1') %>
<% getJS('PATH/TO/FILE2') %>

<%- printJS() %>

Params

route - route from which you want to serve files

version - cache buster, good practice is to use package.version

filePath - location of raw js files

buildPath - location where processed files should be stored (need write permissions on that folder)

sKey - secret key that will be used for encryption

cache - default true, in dev environment set cache to false

ignoreSameFile - default true, ignores same file while registering with getJS()

async - default false, includes async attribute to script tag. More about it here

Testing

npm run test

Why run time ?

  • in case of large application and big number of files doing this in run time is much more convinient
  • this is also useful in case of multivariant tests when we want to have different js for different variants
  • it's easier to use in some case

Notes

For better performance use caching on nginx or akamai.

0.1.10

6 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.0

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago