I'm trying to create some js to lazy loading in html files. So I have to create the patterns inside html comments and than inject the script tags for js files. Something like gulp-inject, but my own way.
Here's html comment examples:
<!--inject:module:js-->
<!--endinject-->
I want to to identify comment patterns and inject the script tag inside then and it should do something like:
<!--inject:module:js-->
<script src="app/start.module.js"></script>
<script src="app/some.module.js"></script>
<script src="app/content.module.js"></script>
<!--endinject-->
Here's what I have tried till now with RegEx:
/(<!--(inject:?([\w]*?)?:?([\w]*?)?)-->)(<!--endinject-->)*?/gm
It will select only the first "inject" comment.
<!--inject:module:js-->
PS.: I'm still newbie in RegEx.
Thanks!