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

Add custom tag option #53

Open
lucipacurar opened this issue Oct 18, 2016 · 4 comments
Open

Add custom tag option #53

lucipacurar opened this issue Oct 18, 2016 · 4 comments

Comments

@lucipacurar
Copy link

Hi,

I'm trying to add a way to customize "build" and "endbuild" tags inside the parser regexp, so I moved the regexp inside the Parser constructor and converted the regexp literal to a string:

this.regex = new RegExp("(\\n?)([ \\t]*)(<!--\\s*" + config.tagName + ":(\\w+(?:-\\w+)*)\\s*-->)\\n?([\\s\\S]*?)\\n?(<!--\\s*end" + config.tagName + "\\s*-->)\\n?", "ig");

Inside the regexp I just escaped the "\" character and concatenated a custom tagname. For some reason the tests fail because the output is different. Since I'm no expert in RegExp, could you please let me know if the regexp above is correct?

The fork is here: https://github.com/lucassp/gulp-html-replace

Thanks!

@VFK
Copy link
Owner

VFK commented Oct 20, 2016

Hi, Lucian. I just tried your fork and it works like a charm. Are you on windows? This might be some weird windows issue or something with line endings or encodings. It's hard to tell really. What exactly are you seeing? What's the difference between expected and actual output?

@lucipacurar
Copy link
Author

Yes, I tried it on Windows. Let me try it on Mac.

@lucipacurar
Copy link
Author

Yeap, everything works like a charm on Mac. I should probably add some tests too.

@lucipacurar
Copy link
Author

Ok, I've added some basic tests for it. I actually made this change because we still use usemin and wiredep inside the same file, and those plugins break down when we try to use them together with gulp-html-replace.

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

No branches or pull requests

2 participants