-
Notifications
You must be signed in to change notification settings - Fork 7
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
Need function that remove comment without removing what inside. #3
Comments
Interesting suggestion. I'll have this implemented for the next version. Thanks. |
@jfmmm Couldn't you just use gulp-strip-comments? |
If I had a time machine maybe. |
@crissdev first, thanks for the module. Any chance of this getting implemented? You mentioned 'next version' back in 2015 and closed #11 last year (the title of which more closely matches what I'm thinking for this issue) In the meantime, @Sugarcaen / @jfmmm how would you use gulp-strip-comments (or something else?) to only remove the empty/remaining '[rR]emoveIf lines? Seems like there's only an 'ignore' regex option there - no explicit 'remove only matches' option. I'd love to be able to [at least somewhat] cleanly strip all 'true' removeIf sections as well as specifically the '[rR]emoveIf' comments from all 'false' removeIf sections... |
Looking at it I don't see how you would do that.. It would need some way to pass a regex or something. Don't remember how I ended up fixing that and don't have access to that project anymore sadly. |
I just want to make sure I'm understanding you, @JoshuaSCochrane, its been a while since I've touched a project using gulp. //removeif(production)
app.doSomething()
//endremoveif(production)
app.doSomethingElse() And get: app.doSomething()
app.doSomethingElse() Correct? |
@Sugarcaen precisely, except ideally controlled by an additional option to the gulp I honestly very briefly considered doing something like this (contrived example): //removeIf(production)
//removeIf(config_A)
//endRemoveIf(production)
module.exports.configBThing = configBThing;
//removeIf(production)
//endRemoveIf(config_A)
//endRemoveIf(production) (so it would remove configBThing if config_A but always remove the removeIfs) but then I realized how abysmally ugly that was going to get and may not even work anyway... :p |
You can clean it up with gulp-delete-lines
Note: This assumes that you use strictly //removeIf and //endRemoveIf comments with no space in-between. Update: |
I also encountered this issue/feature request. I have a feature toggle The I used this:
|
It would be nice if you could add a function or parameters that remove the "removeIf/endRemoveIf" comments without removing what inside of them.
I use gulp-remove-code to remove some stuff from the minified version of my JS files that I don't want in production, but in the unminified version I keep those thing there, but the "removeIf/endRemoveIf" stay as well.
Would love to be able to keep them but remove the "removeIf/endRemoveIf" comments from the final build.
maybe something like
.pipe(removeCode({ removeCommentsOnly: true }))
Thx.
The text was updated successfully, but these errors were encountered: