{"id":13527096,"url":"https://github.com/ben-eb/gulp-uncss","last_synced_at":"2025-04-01T09:31:06.125Z","repository":{"id":12595711,"uuid":"15266592","full_name":"ben-eb/gulp-uncss","owner":"ben-eb","description":"DEPRECATED. Remove unused CSS selectors.","archived":true,"fork":false,"pushed_at":"2017-07-08T20:02:10.000Z","size":39,"stargazers_count":938,"open_issues_count":3,"forks_count":40,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-02T12:34:11.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ben-eb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-17T21:36:18.000Z","updated_at":"2024-10-13T21:01:53.000Z","dependencies_parsed_at":"2022-08-28T11:31:44.742Z","dependency_job_id":null,"html_url":"https://github.com/ben-eb/gulp-uncss","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fgulp-uncss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fgulp-uncss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fgulp-uncss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fgulp-uncss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ben-eb","download_url":"https://codeload.github.com/ben-eb/gulp-uncss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246615958,"owners_count":20806034,"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-01T06:01:41.010Z","updated_at":"2025-04-01T09:31:05.856Z","avatar_url":"https://github.com/ben-eb.png","language":"JavaScript","readme":"# Deprecation Notice\n\nSince UnCSS is now a PostCSS plugin which can be combined with other CSS\nprocessing steps, there is little incentive to add a separate pass to your\nbuild step. Instead of using gulp-uncss, you can replicate the functionality\nby the following gulp task:\n\n```js\nvar gulp = require('gulp');\nvar postcss = require('gulp-postcss');\nvar uncss = require('postcss-uncss');\n\ngulp.task('default', function () {\n    var plugins = [\n        uncss({\n            html: ['index.html', 'posts/**/*.html', 'http://example.com']\n        }),\n    ];\n    return gulp.src('./src/*.css')\n        .pipe(postcss(plugins))\n        .pipe(gulp.dest('./dest'));\n});\n```\n\nNow you can add other plugins to complement UnCSS, such as [cssnano].\n\n[cssnano]: https://github.com/ben-eb/cssnano\n\n# [gulp][gulp]-uncss\n\n\u003e Remove unused CSS with [UnCSS][orig].\n\n*If you have any difficulties with the output of this plugin, please use the\n[UnCSS tracker][bugs].*\n\n## Install\n\nWith [npm](https://npmjs.org/package/gulp-uncss) do:\n\n```\nnpm install gulp-uncss --save-dev\n```\n\n## Example\n\nSingle files, globbing patterns and URLs are all supported by gulp-uncss, and\ncan be mixed and matched:\n\n```js\nvar gulp = require('gulp');\nvar uncss = require('gulp-uncss');\n\ngulp.task('default', function () {\n    return gulp.src('site.css')\n        .pipe(uncss({\n            html: ['index.html', 'posts/**/*.html', 'http://example.com']\n        }))\n        .pipe(gulp.dest('./out'));\n});\n```\n\ngulp-uncss can also be used in a pipeline that involves CSS pre-processing.\nUtilising many transforms on a single file is one of gulp's strengths:\n\n```js\nvar gulp = require('gulp');\nvar uncss = require('gulp-uncss');\nvar sass = require('gulp-sass');\nvar concat = require('gulp-concat');\nvar nano = require('gulp-cssnano');\n\ngulp.task('default', function () {\n    return gulp.src('styles/**/*.scss')\n        .pipe(sass())\n        .pipe(concat('main.css'))\n        .pipe(uncss({\n            html: ['index.html', 'posts/**/*.html', 'http://example.com']\n        }))\n        .pipe(nano())\n        .pipe(gulp.dest('./out'));\n});\n```\n\nIn just a few lines, we compiled SCSS source into a single file, removed unused\nCSS and minified the output!\n\n## Options\n\nPlease see the [UnCSS documentation][docs] for all of the options you can use.\nSome of them aren't as necessary when using gulp-uncss, because the CSS to\nanalyse comes from the stream rather than the HTML files. The main options you\nwill likely be using are:\n\n### html\nType: `Array|String`\n*Required value.*\n\nAn array which can contain an array of files relative to your `gulpfile.js`, and\nwhich can also contain URLs. Note that if you are to pass URLs here, then the\ntask will take much longer to complete. If you want to pass some HTML directly\ninto the task instead, you can specify it here as a string.\n\n### ignore\nType: `Array`\nDefault value: `undefined`\n\nSelectors that should be left untouched by UnCSS as it can't detect user\ninteraction on a page (hover, click, focus, for example). Both literal names and\nregex patterns are recognized.\n\n### timeout\nType: `Integer`\nDefault value: `undefined`\n\nSpecify how long to wait for the JS to be loaded.\n\nNote that `options.ignoreSheets` is *already defined* for you. gulp-uncss will\nonly process CSS files in the stream.\n\n## Contributing\n\nPull requests are welcome. If you add functionality, then please add unit tests\nto cover it.\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[bugs]:    https://github.com/giakki/uncss/issues\n[docs]:    https://github.com/giakki/uncss#within-nodejs\n[gulp]:    https://github.com/gulpjs/gulp\n[orig]:    https://github.com/giakki/uncss\n","funding_links":[],"categories":["Minifiers - JS \u0026 CSS","JavaScript","插件","Plugins"],"sub_categories":["优化","Meetups","Optimization"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-eb%2Fgulp-uncss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fben-eb%2Fgulp-uncss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-eb%2Fgulp-uncss/lists"}