{"id":13800040,"url":"https://github.com/grayleonard/koa-uglify2","last_synced_at":"2025-03-23T09:14:37.471Z","repository":{"id":23308095,"uuid":"26667671","full_name":"grayleonard/koa-uglify2","owner":"grayleonard","description":"Koa middleware to uglify javascript ","archived":false,"fork":false,"pushed_at":"2014-11-18T22:38:21.000Z","size":216,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T23:22:27.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.org/package/koa-uglify2","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grayleonard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-15T03:18:30.000Z","updated_at":"2015-09-06T16:28:59.000Z","dependencies_parsed_at":"2022-08-21T23:50:13.131Z","dependency_job_id":null,"html_url":"https://github.com/grayleonard/koa-uglify2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayleonard%2Fkoa-uglify2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayleonard%2Fkoa-uglify2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayleonard%2Fkoa-uglify2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grayleonard%2Fkoa-uglify2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grayleonard","download_url":"https://codeload.github.com/grayleonard/koa-uglify2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078198,"owners_count":20557282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:08.603Z","updated_at":"2025-03-23T09:14:37.422Z","avatar_url":"https://github.com/grayleonard.png","language":"JavaScript","readme":"koa-uglify2\n===========\n\nKoa middleware to uglify javascript.\nInspired by [express-uglify](https://github.com/ncrohn/express-uglify)\n\nIt automatically uglifies every javascript file served. A basic cache functions to cut down on load time.\n\nInstall\n=======\n\n```\nnpm install koa-uglify2\n```\n\nBasic Usage\n===========\n\n```javascript\nvar koa = require('koa');\nvar app = koa();\nvar uglify = require('koa-uglify2');\n\napp.use(uglify({\n\tsrc: 'public/'\n\t})\n);\n\napp.listen(8080);\n```\n\nAdvanced Usage\n==============\n\nYou can also create regex rules to uglify files that are not served statically.\n\n```javascript\napp.use(uglify({\n\tsrc: 'public/',\n\trules:\t{\n\t\t'google/jquery.js': /^\\/.{3}\\/regexExample\\.js$/\n\t\t}\n\t})\n);\n```\n\nThis rule will serve public/google/jquery.js to any request that matches the regex, for example: ```GET /123/regexExample.js```.  File-level regex needs to end with ```\\.js$/```.\n\nAs well, you can designate a directory-level rule to match all javascript files in the folder.\n\n```javascript\napp.use(uglify({\n\trules:\t{\n\t\t'admin-files/': /^\\/.{5}\\//\n\t\t}\n\t})\n);\n```\n\nThis rule will serve admin-files/*.js to, for example: ```GET /12345/testFile.js```\n","funding_links":[],"categories":["仓库"],"sub_categories":["中间件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayleonard%2Fkoa-uglify2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrayleonard%2Fkoa-uglify2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrayleonard%2Fkoa-uglify2/lists"}