{"id":28172579,"url":"https://github.com/jamesnuttall/injecttwigwebpackplugin","last_synced_at":"2026-04-18T11:01:35.490Z","repository":{"id":57676818,"uuid":"165829769","full_name":"JamesNuttall/InjectTwigWebpackPlugin","owner":"JamesNuttall","description":"Webpack plugin to inject twig js/css register syntax.","archived":false,"fork":false,"pushed_at":"2019-02-01T20:38:47.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-20T08:17:59.648Z","etag":null,"topics":["css","html","injects","javacript","twig","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesNuttall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-15T10:15:53.000Z","updated_at":"2019-02-23T19:37:30.000Z","dependencies_parsed_at":"2022-09-02T22:31:28.566Z","dependency_job_id":null,"html_url":"https://github.com/JamesNuttall/InjectTwigWebpackPlugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesNuttall%2FInjectTwigWebpackPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesNuttall%2FInjectTwigWebpackPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesNuttall%2FInjectTwigWebpackPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesNuttall%2FInjectTwigWebpackPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesNuttall","download_url":"https://codeload.github.com/JamesNuttall/InjectTwigWebpackPlugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414503,"owners_count":22067272,"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":["css","html","injects","javacript","twig","webpack","webpack-plugin"],"created_at":"2025-05-15T20:10:48.418Z","updated_at":"2026-04-18T11:01:30.446Z","avatar_url":"https://github.com/JamesNuttall.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"inject-twig-webpack-plugin\n===\n\n[![NPM](https://nodei.co/npm/inject-twig-webpack-plugin.png)](https://nodei.co/npm/inject-twig-webpack-plugin/)\n\nbased off [inject-html-webpack-plugin](https://github.com/ali322/inject-html-webpack-plugin). Takes js/css files and using the twig `view.register` syntax, injects the files.\n\nInstall\n===\n\n```javascript\nnpm install inject-twig-webpack-plugin --save--dev\n```\n\nUsage\n===\n\nadd plugin in your webpack.config.js\n\n```javascript\nvar InjectTwigPlugin = require('inject-twig-webpack-plugin');\n\nmodule.exports = {\n    entry:{\n        index:\"./index.js\"\n    },\n    module:{\n        loaders:[\n            ...\n        ]\n    },\n    output:{\n        path:'./dist',\n        filename:'[name].min.js'\n    },\n    plugins:[\n        new InjectTwigPlugin({\n            transducer: function (filename) {\n                return \"/assets/js/vue/dist/\"+filename;\n            },\n            filename: '../../../../templates/_layout/_footer.html',\n            chunks:['index']\n        })\n    ]\n}\n```\n\nthen add below placeholders into html file\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003ctitle\u003eDocument\u003c/title\u003e\n  \u003c!-- start:css --\u003e\n  \u003c!-- end:css --\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003c!-- start:js --\u003e\n  \u003c!-- end:js --\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nOutput\n===\n\n```\n\u003c!-- start:js --\u003e \n{% do view.registerJsFile(siteUrl ~ \"/assets/js/vue/dist/index.c38144da9d3ebd917778.js\") %}\n\u003c!-- end:js --\u003e\n```\n\n## License\n\n[MIT License](http://en.wikipedia.org/wiki/MIT_License)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesnuttall%2Finjecttwigwebpackplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesnuttall%2Finjecttwigwebpackplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesnuttall%2Finjecttwigwebpackplugin/lists"}