taptapship / wiredep

Wire Bower dependencies to your source code.
MIT License
1.15k stars 142 forks source link

Any way to remove injected sources from .html if removing a bower dependency from project? #227

Closed toymachiner62 closed 8 years ago

toymachiner62 commented 8 years ago

Is there any way to use wiredep to remove a dependency from my .html file that has been injected via wiredep?

I'm thinking that if i end up removing a bower dependency that is no longer needed, it'd be nice to use the bower hook preuninstall to remove the files from my .html file that were previously inject if i decide i no longer need a bower dependency.

gustafl commented 8 years ago

I was lacking this too, and had a go with it today. I used gulp-delete-lines to delete injected dependencies. I made one task for deleting <link ref="stylesheet"> tags and one for deleting <script> tags. Then I added my wiredep task to both the postinstall and preuninstall hooks in my .bowerrc file, and made the delete tasks and the wiredep task depend on each other serially (because they all modify the same file).

  1. delete-styles
  2. delete-scripts
  3. wiredep

Unfortunately, it didn't work out completely. Running the delete tasks manually works great, but when I run all three tasks together, nothing is deleted. According to console output, each task completes before the next starts, but things are still not deleted in the HTML.

Well, I'm content with the delete tasks I created, and just run them manually for now. Hopefully, gulp.series() in Gulp 4 will solve it.

eddiemonge commented 8 years ago

Run wiredep again and it will automatically remove them. Is it not doing that for you?

eddiemonge commented 8 years ago

If that doesn't work then I will re-open this issue.