Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for single replacement of params #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benrr101
Copy link

This is a fix for #3 where using a variable more than once isn't replaced. The solution to this is to use javascript's global replace functionality, which requires using a regex with a global flag for finding the substring. I've added in a helper function from stack overflow to make sure that special characters in the variable are escaped. I've also pretty much rewritten the replaceAttributes function so it's a lot more readable (sorry, that's mostly personal preference since I can't understand comma operator statements to save my life).

Let me know if there's anything you'd like me to tweak to make it easier to add this to your project!
This is a great helper to me, since it's simple and does the job! Thanks!

migueldelmazo added a commit to Adalab/gulp-html-partial that referenced this pull request Feb 13, 2020
@benrr101 benrr101 requested a review from xkxd February 21, 2020 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant