https://github.com/cnwhy/res-minify
自动压缩合并js css, express中间件
https://github.com/cnwhy/res-minify
Last synced: 12 months ago
JSON representation
自动压缩合并js css, express中间件
- Host: GitHub
- URL: https://github.com/cnwhy/res-minify
- Owner: cnwhy
- Created: 2015-11-09T08:14:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-27T09:08:10.000Z (about 9 years ago)
- Last Synced: 2025-06-07T08:08:01.175Z (about 1 year ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
Awesome Lists containing this project
README
自动压缩合并js css,自动编译Less, express中间件
demo:
```
var resminify = require("res-minify")
app.use(resminify(path.join(__dirname, 'public')));
app.use("/v2",resminify(path.join(__dirname, 'public'),{"reAbsolute":true}));
```
##API resminify(path,options)
*path* 物理路径
*options* 配置
```js
//defined
{
"compressCSS": true //css压缩
,"reAbsolute": false //是否转换CSS中原有的绝对路径
,"compressJS": true //js压缩
,"compileLess": true //编译Less文件
,"serverCache":true //服务器缓存
,"fileMaxAge":604800 //浏览器缓存时间
,"cacheFilePaths": "" //缓存目录 不设置则缓存到内存
,"directoryList":false //目录浏览
,"defaultFile":["index.html","index.htm","default.html","default.htm"] //默认文件,开启目录浏览后失效;
,"baseUrl":undefined //reAbsolute 转换绝对路径的时前缀,默认取值req.baseUrl
}
```
*自动合并访问规则*
http:/XXX/js/??a.js,b.js
http:/XXX/css/??a.css,b.css