{"id":25376785,"url":"https://github.com/terrierscript/grunt-pipe","last_synced_at":"2025-04-09T10:33:42.454Z","repository":{"id":10580554,"uuid":"12789433","full_name":"terrierscript/grunt-pipe","owner":"terrierscript","description":"[Deprecated] Grunt plugin that pipe file","archived":false,"fork":false,"pushed_at":"2023-03-20T20:41:43.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T00:37:29.550Z","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/terrierscript.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-09-12T17:06:45.000Z","updated_at":"2023-03-04T06:09:03.000Z","dependencies_parsed_at":"2023-02-14T13:02:20.890Z","dependency_job_id":null,"html_url":"https://github.com/terrierscript/grunt-pipe","commit_stats":null,"previous_names":["suisho/grunt-pipe"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrierscript%2Fgrunt-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrierscript%2Fgrunt-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrierscript%2Fgrunt-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrierscript%2Fgrunt-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terrierscript","download_url":"https://codeload.github.com/terrierscript/grunt-pipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248020591,"owners_count":21034459,"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":"2025-02-15T04:39:18.903Z","updated_at":"2025-04-09T10:33:42.429Z","avatar_url":"https://github.com/terrierscript.png","language":"JavaScript","readme":"\u003e **Warning**\n\u003e This project is not maintained\n\n# grunt-pipe\n\n\u003e Simple file pipe process\n\n## Getting Started\nThis plugin requires Grunt `~0.4.1`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-pipe --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-pipe');\n```\n\n## The \"pipe\" task\n\n### Overview\nIn your project's Gruntfile, add a section named `pipe` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  pipe: {\n    your_target: {\n      options: {\n        ignoreEmpty : true,\n        domMode : false,\n        process : function(content, options, grunt, srcFilePath){\n          // write your want content\n          return content\n        }\n      },\n\n      // Target-specific file lists and/or options go here.\n    },\n  },\n})\n```\n\n### Options\n\n#### options.process\nType: `Function`\n\nProcessing function that has below arguments.\n- content\n  - `String`\n  - source file content.\n- filepath\n  - `String`\n  - source file path\n- grunt\n  - `Object`\n  - grunt object\n\n- example\n  - this example replace content item\n```javascript\nfunction(content, filepath, grunt){\n  return content.replace(/baz/,\"foo\")\n}\n```\n\n\n#### options.ignoreEmpty\nType: `Boolean`\nDefault value: `true`\n\nWhen this value true and process result is empty value, this task not output anything.\n\n#### options.domMode\nType: `Boolean`\nDefault value: `false`\n\nIf true, convert content to [cheerio](https://npmjs.org/package/cheerio) dom object.\n\nYou can handling dom in options.process for example below.\n\n```javascript\nfunction($, filepath, grunt){\n  $(\"div\").attr(\"foo\",\"baz\")\n  return $.html()\n}\n```\n\n### Usage Examples\n#### Simple usage\nIn this sample, replace test/fixtures/foo's content's baz to foo.\n\n```js\ndefault_options: {\n  options: {\n    process : function(content, filepath, grunt){\n      return content.replace(/baz/,\"foo\")\n    }\n  },\n  files: {\n    'tmp/foo': 'test/fixtures/foo'\n  },\n},\n```\n\n#### Dom Mode\nIn this sample, change dom items.\n\n```js\ndom_mode: {\n  options: {\n    domMode : true,\n    process : function($, filepath, grunt){\n      $(\"div\").attr(\"foo\",\"baz\")\n      return $.html()\n    }\n  },\n  files: {\n    'tmp/dom_mode': 'test/fixtures/dom_mode'\n  },\n},\n````\n\n#### Multiple sources.\nMultiple source file sample.\nIf files has multiple source file, ouput concat each result.\n\n```js\nmultifiles : {\n  options: {\n    process : function(content, filepath, grunt){\n      return  \"filepath:\" + filepath + \"\\n\"\n            + \"content:\" + content + \"\\n\"\n    }\n  },\n  files: {\n    'tmp/multifiles': ['test/fixtures/foo', 'test/fixtures/dom_mode']\n  },\n}\n```\n\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n_(Nothing yet)_\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrierscript%2Fgrunt-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterrierscript%2Fgrunt-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrierscript%2Fgrunt-pipe/lists"}