{"id":15044824,"url":"https://github.com/modernizr/gulp-modernizr","last_synced_at":"2025-05-16T05:06:07.572Z","repository":{"id":13235366,"uuid":"15920015","full_name":"Modernizr/gulp-modernizr","owner":"Modernizr","description":"Gulp wrapper for custom Modernizr builds","archived":false,"fork":false,"pushed_at":"2024-11-19T06:45:14.000Z","size":1220,"stargazers_count":117,"open_issues_count":5,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-15T15:14:26.253Z","etag":null,"topics":["gulp","gulp-plugin","modernizr"],"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/Modernizr.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-15T00:12:31.000Z","updated_at":"2024-11-19T06:45:11.000Z","dependencies_parsed_at":"2024-06-18T13:43:09.666Z","dependency_job_id":"15280be9-11bd-4501-9dc0-fbe4a0bf7e3d","html_url":"https://github.com/Modernizr/gulp-modernizr","commit_stats":{"total_commits":136,"total_committers":11,"mean_commits":"12.363636363636363","dds":0.5147058823529411,"last_synced_commit":"8a88dde250206457de796c9bd5b99e2f0b3e06b3"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modernizr%2Fgulp-modernizr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modernizr%2Fgulp-modernizr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modernizr%2Fgulp-modernizr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Modernizr%2Fgulp-modernizr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Modernizr","download_url":"https://codeload.github.com/Modernizr/gulp-modernizr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"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":["gulp","gulp-plugin","modernizr"],"created_at":"2024-09-24T20:51:05.529Z","updated_at":"2025-05-16T05:06:07.536Z","avatar_url":"https://github.com/Modernizr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-modernizr \n\n[![Build Status](https://github.com/Modernizr/gulp-modernizr/actions/workflows/testing.yml/badge.svg)](https://github.com/Modernizr/gulp-modernizr/actions/workflows/testing.yml)\n[![npm version](https://badge.fury.io/js/gulp-modernizr.svg)](https://badge.fury.io/js/gulp-modernizr)\n\nA [Gulp](https://gulpjs.com/) wrapper for [Modernizr](https://github.com/Modernizr/customizr).\n\n*Note*: This plugin uses version 3 of Modernizr. Make sure to check the [Github repo](https://github.com/Modernizr/Modernizr/tree/master/feature-detects) for the correct feature names (example: ```Modernizr.touch``` was renamed to ```Modernizr.touchevents```).\n\n## Usage\n\nFirst, install `gulp-modernizr` as a development dependency:\n\n```shell\nnpm install --save-dev gulp-modernizr\n```\n\nThen, add it to your `gulpfile.js`:\n\n```javascript\nvar modernizr = require('gulp-modernizr');\n\ngulp.task('modernizr', function() {\n  return gulp.src('./js/*.js')\n    .pipe(modernizr())\n    .pipe(gulp.dest('build/'))\n});\n```\n\nRunning the plugin will search for tests in your `src` files like this one for example:\n\n```javascript\nif (!Modernizr.objectfit) { doSomethingLikeCallAPolyfill(); }\n```\n\nand in this case add the 'objectfit' test to the ouptut file.\n\n## API\n\n### modernizr(fileName)\n\n#### fileName\nType: `String`\n\nYou can optionally pass a fileName to name the Modernizr file (defaults to `modernizr.js`)\n\n```javascript\ngulp.src('./js/*.js')\n  .pipe(modernizr('modernizr-custom.js'));\n```\n\n### modernizr(/*fileName, */ settings)\n\n#### settings\nType: `Object`\n\nYou can pass settings as an object. See the [customizr repository](https://github.com/Modernizr/customizr#config-file) for valid settings.\n\n```javascript\ngulp.src('./js/*.js')\n  .pipe(modernizr({\n    'options': ['setClasses'],\n    'tests': [\n      'webworkers',\n      [\n        'cssgrid',\n        'cssgridlegacy'\n      ]\n    ],\n    excludeTests: ['csstransforms3d']\n  })\n);\n```\n\nThe 'settings' object can also be required from a JSON file:\n\nmodernizr-config.json:\n```javascript\n{\n  'options': ['setClasses'],\n  'tests': [\n      'webworkers',\n      [\n          'cssgrid',\n          'cssgridlegacy'\n      ]\n  ],\n  excludeTests: ['csstransforms3d']\n}\n```\n\ngulpfile.js:\n\n```javascript\ngulp.src('./js/*.js')\n .pipe(modernizr(require('./modernizr-config.json')))\n```\n\n#### Available Settings\n##### See the [customizr repository](https://github.com/Modernizr/customizr#config-file) for valid settings.\n\n#### `settings.crawl`\n\nBy default, `glup-modernizr` will not output any `Modernizr.js` if your `gulp.src` does not contain any file, \nregardless of the `tests` you may have set.\n\nIf you only want to output a `Modernizr.js` file with some `tests` you set, just pass a fake path to `gulp.src`:\n\n```javascript\ngulp.src('fake', {allowEmpty: true})\n  .pipe(modernizr({\n    crawl: false,\n    tests: [\n      'touchevents',\n    ],\n  })\n)\n```\n\n#### `settings.quiet`\nDefaults to `false`, setting it to `true` suppresses any log output from customizr\n\n#### `settings.uglify`\nWill never be passed to customizr, see the [Gulp guidelines](https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/guidelines.md). The option to uglify the build goes against guidelines #1 and #3. Thus, this setting has been removed from this plugin. You may use [`gulp-uglify`](https://npmjs.org/package/gulp-uglify) to achieve this functionality in Gulp:\n\n```javascript\ngulp.src('./js/*.js')\n  .pipe(modernizr())\n  .pipe(uglify())\n  .pipe(gulp.dest(\"build/\"));\n```\n\n## License\nCopyright (c) 2024 The Modernizr team\nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodernizr%2Fgulp-modernizr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodernizr%2Fgulp-modernizr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodernizr%2Fgulp-modernizr/lists"}