npm

Join us for the upcoming webinar, "Enterprise JavaScript done right: the tools you love, the security you need."Sign up here »

connect-minify

0.0.1 • Public • Published

Build Status

Usage

var minify = require('connect-minify');

app.use(minify({
  // assets map - maps served file identifier to a list of resources
  assets: {
    "/js/main.min.js": [
      '/js/lib/jquery.js',
      '/js/magick.js',
      '/js/laughter.js'
    ],
    "/css/home.min.css": [
      '/css/reset.css',
      '/css/home.css'
    ],
    "/css/dashboard.min.css": [
      '/css/reset.css',
      '/css/common.css'
      '/css/dashboard.css'
    ] },
  // root - where resources can be found
  root: path.join(__dirname, '..', 'static),
  // default is to minify files
  disable_minification: false
});

Then later to generate a URL:

app.use(function(req, res, next) {
  req.minifiedURL('/css/home.min.css');
});

Or to do the same in a template:

<head>
  <script src="<%- minifiedURL('/js/main.min.js') %>"></script>
</head>

Keywords

none

install

npm i connect-minify

Downloadsweekly downloads

1

version

0.0.1

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability