You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Took me a while to figure out why this wasn't working with my PHP files, but I realized it's because PHP wasn't being recognized as using "HTML-style" comments. I rectified it by using the commentStart and commentEnd parameters, but then I got thinking.
What if I needed to remove blocks of HTML code in one part of a PHP file, and PHP code in another part? I suppose I could wrap the HTML parts in <?php /*removeIf(condition)*/ ?> ... <?php /*endRemoveIf(condition)*/ ?>, but then I'd be stuck with an empty <?php ?>, which isn't ideal.
Additionally, what if I want to search multiple file types for the same condition? For example, remove all PHP, HTML, JS, and CSS for a module. I'd have to duplicate a lot of code in my task, saying "check this format, and then this format, and then this one," which again, isn't ideal.
I'd really like to see an option to set commentStart and commentEnd as arrays, something like the following:
gulp.task("init", function () {
return gulp.src(src + "/**/*")
// remove login HTML code if --remove --login is passed
.pipe(gulpif(argv.remove && argv.login, removeCode({no_login: true, commentStart: ["<!--", "/*", "//"], commentEnd: ["-->", "*/", ""]})))
// return to the source directory
.pipe(gulp.dest(src));
});
That way you could parse multiple file types at once.
The text was updated successfully, but these errors were encountered:
@crissdev any chance you could implement this? I've found a workaround, but I have to add multiple calls to the module with differing names, which seems very inefficient.
Took me a while to figure out why this wasn't working with my PHP files, but I realized it's because PHP wasn't being recognized as using "HTML-style" comments. I rectified it by using the
commentStart
andcommentEnd
parameters, but then I got thinking.What if I needed to remove blocks of HTML code in one part of a PHP file, and PHP code in another part? I suppose I could wrap the HTML parts in
<?php /*removeIf(condition)*/ ?> ... <?php /*endRemoveIf(condition)*/ ?>
, but then I'd be stuck with an empty<?php ?>
, which isn't ideal.Additionally, what if I want to search multiple file types for the same condition? For example, remove all PHP, HTML, JS, and CSS for a module. I'd have to duplicate a lot of code in my task, saying "check this format, and then this format, and then this one," which again, isn't ideal.
I'd really like to see an option to set
commentStart
andcommentEnd
as arrays, something like the following:That way you could parse multiple file types at once.
The text was updated successfully, but these errors were encountered: