{"id":16629059,"url":"https://github.com/reisraff/phulp-inject","last_synced_at":"2025-12-25T06:04:15.160Z","repository":{"id":62534508,"uuid":"72137133","full_name":"reisraff/phulp-inject","owner":"reisraff","description":"The inject addon for phulp","archived":false,"fork":false,"pushed_at":"2021-01-27T19:09:26.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-18T05:14:24.249Z","etag":null,"topics":["inject","php","phulp","phulp-inject","phulpplugin"],"latest_commit_sha":null,"homepage":"https://github.com/reisraff/phulp ","language":"PHP","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/reisraff.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":"2016-10-27T18:36:08.000Z","updated_at":"2021-01-27T19:09:28.000Z","dependencies_parsed_at":"2022-11-02T15:15:29.847Z","dependency_job_id":null,"html_url":"https://github.com/reisraff/phulp-inject","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fphulp-inject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fphulp-inject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fphulp-inject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fphulp-inject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reisraff","download_url":"https://codeload.github.com/reisraff/phulp-inject/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243075808,"owners_count":20232428,"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":["inject","php","phulp","phulp-inject","phulpplugin"],"created_at":"2024-10-12T04:39:16.177Z","updated_at":"2025-12-25T06:04:10.108Z","avatar_url":"https://github.com/reisraff.png","language":"PHP","readme":"# phulp-inject\n\nThe inject addon for [PHULP](https://github.com/reisraff/phulp).\n\nIt's like [gulp-inject](https://github.com/klei/gulp-inject) with some modifications.\n\n## Install\n\n```bash\n$ composer require reisraff/phulp-inject\n```\n\n## Usage\n\n**The target file `src/index.html`:**\n\nEach pair of comments are the injection placeholders\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003eApp\u003c/title\u003e\n  \u003c!-- inject:css --\u003e\n  \u003c!-- endinject --\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\n  \u003c!-- inject:js --\u003e\n  \u003c!-- endinject --\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n**The `phulpfile.php`:**\n\n```php\n\u003c?php\n\nuse Phulp\\Inject\\Inject;\n\n$phulp-\u003etask('inject', function ($phulp) {\n    $injectionFiles = $phulp-\u003esrc(['src/'], '/(js|css)$/', true);\n\n    $phulp-\u003esrc(['src/'], '/html$/')\n        // injecting\n        -\u003epipe(new Inject($injectionFiles-\u003egetDistFiles()))\n        // write the html file with the injected files\n        -\u003epipe($phulp-\u003edest('dist/'));\n});\n```\n\n**`dist/index.html` after running `phulp inject`:**\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003eApp\u003c/title\u003e\n  \u003c!-- inject:css --\u003e\n  \u003clink rel=\"stylesheet\" href=\"css/sytle.css\"\u003e\n\u003clink rel=\"stylesheet\" href=\"css/style2.css\"\u003e\n\u003c!-- endinject --\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\n  \u003c!-- inject:js --\u003e\n  \u003cscript src=\"js/script.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"js/script2.js\"\u003e\u003c/script\u003e\n\u003c!-- endinject --\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Options\n\nSet in the constructor.\n\n***tagname*** : default: inject, it is used to define a global tagname as placeholder.\n\n***starttag*** : default: null, it is used to replace the default starttag\n\n***endtag*** : default: null, it is used to replace the default endtag\n\n***filterFilename*** : default: null, it is used to replace the filename\n\n```php\n\u003c?php\n\nuse Phulp\\Inject\\Inject;\n\n$cssMinifier = new Inject(\n  $distFiles,\n  [\n    'tagname' =\u003e 'replace-inject',\n    'starttag' =\u003e '\u003c-- replace-inject --\u003e',\n    'endtag' =\u003e '\u003c-- endreplace-inject --\u003e,\n    'filterFilename' =\u003e function ($filename) {\n      return 'path/' . $filename;\n    },\n  ]\n);\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freisraff%2Fphulp-inject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freisraff%2Fphulp-inject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freisraff%2Fphulp-inject/lists"}