gulp-inject-string
gulp-inject-string copied to clipboard
Add a custom method
Hi, I need to make something more difficult than just string replace. And I think about implementing custom method that will give us ability to make any manipulations with strings on javascript.
For example. I've faced with problem when on my gulp environment I've needed parse regex occurrence and return different strings. Here is my working code:
.pipe($.injectString.custom(function (str) { return str.replace(new RegExp('(z-var\\s*:\\s*)(\\w*)(.*;)', 'g'), function (match, g1, g2, g3) { return '{' + g2 + '}'; }); })
This function find and replace z-var: varName;
to {varName}
Created a pull request. #12
Hi @mikehazell, could you please take a look on my pull request?
Hi @mikehazell, just a ping in hope You'll answer.
+1
It's been a year passed and no reaction. @mikehazell is this package still supported?
Hey @evanre, sorry. I don't really use gulp anymore so this just doesn't make my priority list very often.
I've merged in your changes and added another PR which would resolve #5 and #8. There was some confusion around regex's which I hope this will solve.
Would love your feedback and if you could test this in a project to see if I broke anything I wasn't expecting. See this PR #17.
These 2 prs will be released together as major version bump v2.0.0
.