{"id":13671921,"url":"https://github.com/terinjokes/gulp-uglify","last_synced_at":"2025-05-14T06:13:06.098Z","repository":{"id":49220344,"uuid":"11188838","full_name":"terinjokes/gulp-uglify","owner":"terinjokes","description":"Minify files with UglifyJS","archived":false,"fork":false,"pushed_at":"2021-06-23T02:51:11.000Z","size":365,"stargazers_count":1226,"open_issues_count":18,"forks_count":154,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-05-08T00:11:22.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terinjokes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-05T00:25:15.000Z","updated_at":"2025-04-19T19:04:06.000Z","dependencies_parsed_at":"2022-09-08T02:21:38.126Z","dependency_job_id":null,"html_url":"https://github.com/terinjokes/gulp-uglify","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terinjokes%2Fgulp-uglify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terinjokes%2Fgulp-uglify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terinjokes%2Fgulp-uglify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terinjokes%2Fgulp-uglify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terinjokes","download_url":"https://codeload.github.com/terinjokes/gulp-uglify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254080958,"owners_count":22011527,"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-02T09:01:22.087Z","updated_at":"2025-05-14T06:13:06.042Z","avatar_url":"https://github.com/terinjokes.png","language":"JavaScript","funding_links":[],"categories":["Getting Started","JavaScript","插件","Plugins"],"sub_categories":["Overview","压缩","Minification"],"readme":"# gulp-uglify [![][travis-shield-img]][travis-shield][![][appveyor-shield-img]][appveyor-shield][![][npm-dl-shield-img]][npm-shield][![][npm-v-shield-img]][npm-shield][![][coveralls-shield-img]][coveralls-shield]\n\n\u003e Minify JavaScript with UglifyJS3.\n\n## Installation\n\nInstall package with NPM and add it to your development dependencies:\n\n`npm install --save-dev gulp-uglify`\n\n## Usage\n\n```javascript\nvar gulp = require('gulp');\nvar uglify = require('gulp-uglify');\nvar pipeline = require('readable-stream').pipeline;\n\ngulp.task('compress', function () {\n  return pipeline(\n        gulp.src('lib/*.js'),\n        uglify(),\n        gulp.dest('dist')\n  );\n});\n```\n\nTo help properly handle error conditions with Node streams, this project\nrecommends the use of\n[`pipeline`](https://nodejs.org/docs/latest/api/stream.html#stream_stream_pipeline_streams_callback),\nfrom [`readable-stream`](https://github.com/nodejs/readable-stream).\n\n## Options\n\nMost of the [minify options](https://github.com/mishoo/UglifyJS2#minify-options) from\nthe UglifyJS API are supported. There are a few exceptions:\n\n1. The `sourceMap` option must not be set, as it will be automatically configured\n   based on your Gulp configuration. See the documentation for [Gulp sourcemaps][gulp-sm].\n\n[gulp-sm]: https://github.com/gulp-sourcemaps/gulp-sourcemaps#usage\n\n## Errors\n\n`gulp-uglify` emits an 'error' event if it is unable to minify a specific file.\nThe GulpUglifyError constructor is exported by this plugin for `instanceof` checks.\nIt contains the following properties:\n\n- `fileName`: The full file path for the file being minified.\n- `cause`: The original UglifyJS error, if available.\n\nMost UglifyJS error messages have the following properties:\n\n- `message` (or `msg`)\n- `filename`\n- `line`\n\nTo see useful error messages, see [Why Use Pipeline?](docs/why-use-pipeline/README.md#why-use-pipeline).\n\n## Using a Different UglifyJS\n\nBy default, `gulp-uglify` uses the version of UglifyJS installed as a dependency.\nIt's possible to configure the use of a different version using the \"composer\" entry point.\n\n```javascript\nvar uglifyjs = require('uglify-js'); // can be a git checkout\n                                     // or another module (such as `uglify-es` for ES6 support)\nvar composer = require('gulp-uglify/composer');\nvar pump = require('pump');\n\nvar minify = composer(uglifyjs, console);\n\ngulp.task('compress', function (cb) {\n  // the same options as described above\n  var options = {};\n\n  pump([\n      gulp.src('lib/*.js'),\n      minify(options),\n      gulp.dest('dist')\n    ],\n    cb\n  );\n});\n```\n\n[travis-shield-img]: https://img.shields.io/travis/terinjokes/gulp-uglify/master.svg?label=Travis%20CI\u0026style=flat-square\n[travis-shield]: https://travis-ci.org/terinjokes/gulp-uglify\n[appveyor-shield-img]: https://img.shields.io/appveyor/ci/terinjokes/gulp-uglify/master.svg?label=AppVeyor\u0026style=flat-square\n[appveyor-shield]: https://ci.appveyor.com/project/terinjokes/gulp-uglify\n[npm-dl-shield-img]: https://img.shields.io/npm/dm/gulp-uglify.svg?style=flat-square\n[npm-shield]: https://yarnpkg.com/en/package/gulp-uglify\n[npm-v-shield-img]: https://img.shields.io/npm/v/gulp-uglify.svg?style=flat-square\n[coveralls-shield-img]: https://img.shields.io/coveralls/terinjokes/gulp-uglify/master.svg?style=flat-square\n[coveralls-shield]: https://coveralls.io/github/terinjokes/gulp-uglify\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterinjokes%2Fgulp-uglify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterinjokes%2Fgulp-uglify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterinjokes%2Fgulp-uglify/lists"}