express-uglify

2019-10-16 admin

express-uglify是什么

什么是express-uglify,Express.js view engine plugin for Uglify JS

express-uglify使用教程帮助文档

Express Uglify JS

Build Status

Notice

With the release of Node 0.8.0 in the 0.3.0 release of express-uglify support has been dropped for Node 0.4.x and below. If you are still using Node 0.4.x please continue to use 0.2.x and below of express-uglify.

About

This package is designed to provide a middleware solution for on the fly compression of JavaScript files. Code for embedding stays identical so switching between development and production states is as simple as changing the config for express.

What it does

The Express Uglify middleware intercepts JS file calls and runs them through the UglifyJS package to compress and cache the files. If the file has been previously cached it just access that file on disk in a .cache directory and serves that file. All cached files are stored as xxxxx.ugly.js where xxxxx is the starting point. i.e. jquery-1.6.2.js -> jquery-1.6.2.ugly.js

To Do

  • Use ConnectJS caching API to provide proper headers
  • Comprehensive unit tests

Usage:

var expressUglify = require('express-uglify');
app.use(expressUglify.middleware({ 
  src: __dirname + '/public',
  logLevel: 'info',
  logger: new (winston.Logger)() // Specify your own winston logger or category
}));

MIT LICENSE

你可能感兴趣的文章:

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-77546.html

文章标题:express-uglify

回到顶部