{"id":13447294,"url":"https://github.com/ko-yelie/gulp-rollup-each","last_synced_at":"2025-03-21T17:31:11.774Z","repository":{"id":16336841,"uuid":"79734381","full_name":"ko-yelie/gulp-rollup-each","owner":"ko-yelie","description":"Gulp plugin for Rollup. Yet another gulp-rollup plugin that allows to input/output multiple files.","archived":false,"fork":false,"pushed_at":"2023-01-08T17:29:31.000Z","size":841,"stargazers_count":9,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T04:05:15.043Z","etag":null,"topics":["gulp-plugins","rollup","static-site"],"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/ko-yelie.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":"2017-01-22T17:52:53.000Z","updated_at":"2022-06-29T08:17:35.000Z","dependencies_parsed_at":"2023-01-13T18:48:10.200Z","dependency_job_id":null,"html_url":"https://github.com/ko-yelie/gulp-rollup-each","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ko-yelie%2Fgulp-rollup-each","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ko-yelie%2Fgulp-rollup-each/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ko-yelie%2Fgulp-rollup-each/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ko-yelie%2Fgulp-rollup-each/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ko-yelie","download_url":"https://codeload.github.com/ko-yelie/gulp-rollup-each/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244450117,"owners_count":20454595,"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-plugins","rollup","static-site"],"created_at":"2024-07-31T05:01:13.160Z","updated_at":"2025-03-21T17:31:11.379Z","avatar_url":"https://github.com/ko-yelie.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# gulp-rollup-each\n\nGulp plugin for [Rollup](https://rollupjs.org).\u003cbr\u003e\nYet another gulp-rollup plugin that allows to input/output multiple files for static site.\n\n## Installation\n\n[npm](https://www.npmjs.com/package/gulp-rollup-each)\n\n```sh\nnpm i gulp-rollup-each\n```\n\n## Usage\n\n```js\nconst gulp = require('gulp')\nconst rollupEach = require('gulp-rollup-each')\n\nfunction scripts () {\n  return gulp\n    .src([\n      'src/**/*.js',\n      '!src/**/_*' // exclude modules\n    ])\n    .pipe(\n      rollupEach({\n        output: {\n          // outputOptions\n          format: 'iife'\n        }\n      })\n    )\n    .pipe(gulp.dest('dist'))\n}\n```\n\nwith sourcemaps and Buble\n\n```js\nconst gulp = require('gulp')\nconst sourcemaps = require('gulp-sourcemaps')\nconst rollupEach = require('gulp-rollup-each')\nconst buble = require('@rollup/plugin-buble')\n\nfunction scripts () {\n  return gulp\n    .src([\n      'src/**/*.js',\n      '!src/**/_*' // exclude modules\n    ])\n    .pipe(sourcemaps.init())\n    .pipe(\n      rollupEach(\n        {\n          // inputOptions\n          external: ['jquery'],\n          plugins: [\n            buble({\n              target: {\n                ie: 11\n              }\n            })\n          ],\n          isCache: true // enable Rollup cache\n        },\n        {\n          // outputOptions\n          format: 'iife',\n          globals: {\n            jquery: 'jQuery'\n          }\n        }\n      )\n    )\n    .pipe(sourcemaps.write())\n    .pipe(gulp.dest('dist'))\n}\n```\n\n## Options\n\n### `rollupEach(inputOptions [[, outputOptions], rollup])`\n\n#### `inputOptions`\n\nThe 1st argument is the same object as [`inputOptions`](https://rollupjs.org/guide/en#inputoptions).\u003cbr\u003e\nHowever, **the `input` option is the file specified in `gulp.src()`**, so it can not be specified as gulp-rollup-each option.\n\nIf you want to enable the Rollup [`cache`](https://rollupjs.org/guide/en#cache), set `isCache` option to `true`.\n\n```js\nfunction scripts () {\n  return gulp\n    .src(['src/**/*.js'])\n    .pipe(\n      rollupEach(\n        {\n          isCache: true // enable Rollup cache\n        },\n        {\n          format: 'iife'\n        }\n      )\n    )\n    .pipe(gulp.dest('dist'))\n}\n```\n\n#### `outputOptions`\n\nThe 2nd argument is the same object as [`outputOptions`](https://rollupjs.org/guide/en#outputoptions).\u003cbr\u003e\nIf you omit the 2nd argument, `output` in the 1st argument changes to `outputOptions`.\n\n```js\nfunction scripts () {\n  return gulp\n    .src(['src/**/*.js'])\n    .pipe(\n      rollupEach({\n        output: {\n          // outputOptions\n          format: 'iife'\n        }\n      })\n    )\n    .pipe(gulp.dest('dist'))\n}\n```\n\nYou can also pass a function that returns rollup options object as an argument. The function will receive [vinyl](https://github.com/gulpjs/vinyl) file object.\n\n```js\nconst path = require('path')\nconst gulp = require('gulp')\nconst rollupEach = require('gulp-rollup-each')\n\nfunction scripts () {\n  return gulp\n    .src(['src/**/*.js'])\n    .pipe(\n      rollupEach(\n        {\n          external: [/* ... */],\n          plugins: [/* ... */]\n        },\n        file =\u003e {\n          return {\n            format: 'umd',\n            name: path.basename(file.path, '.js')\n          }\n        }\n      )\n    )\n    .pipe(gulp.dest('dist'))\n}\n```\n\n#### `rollup`\n\nYou can specify the 3rd argument for replacing `rollup` object by your dependency. It is useful if you want to use a new version of rollup than gulp-rollup-each is using.\n\n```js\nfunction scripts () {\n  return gulp\n    .src(['src/**/*.js'])\n    .pipe(\n      rollupEach(\n        {},\n        {\n          format: 'iife'\n        },\n\n        // Passing rollup object\n        require('rollup')\n      )\n    )\n    .pipe(gulp.dest('dist'))\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fko-yelie%2Fgulp-rollup-each","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fko-yelie%2Fgulp-rollup-each","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fko-yelie%2Fgulp-rollup-each/lists"}