Doesn't remove injections when stream is empty
See original GitHub issueHi,
I’m using gulp-inject to inject some files ./app/scripts/**/*.js
into my index.html. When gulp finds files, the plugin works as expected and injects all files. But when I remove all files from the filesystem the files aren’t removed in the index.html. I experimented a little bit and found out that when at least one file is in the stream the plugin correctly removes all others. When I remove the last file, the index.html remains untouched resulting in 404’s.
I reduced the problem to this simple task to reproduce it:
gulp.task('inject', function () {
var jsFiles = gulp.src(['./app/scripts/**/*.js']);
return gulp.src('./app/index.html')
.pipe($.inject(jsFiles, {relative: true}))
.pipe(gulp.dest('./app'));
});
Am I doing something wrong or is this the intended behavior?
Issue Analytics
- State:
- Created 9 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
How do you remove "null" values from a Java Stream [duplicate]
Here's a few ways I can think of: stream.filter(x -> x != null). stream.filter(Objects::nonNull).
Read more >How To: Lipo Injections at Home - Invigor Medical
In order to get the best results from the lipotropic injection, it is recommended that you administer the shot on an empty stomach...
Read more >Common Questions About Giving Yourself Shots - PeaceHealth
If you need to give yourself injections, or shots, at home, ... If you're bleeding after you remove the needle, apply direct pressure...
Read more >Empty Nose Syndrome: What It Is, Causes & Treatment
Empty nose syndrome (ENS) is a rare and controversial condition that's most common in people who've had nasal surgery.
Read more >SQL Injection in Java and How to Easily Prevent it | DigitalOcean
SQL Injection is one of the top 10 web application vulnerabilities. ... They can alter, delete data in your database and take your ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
in case if anybody need workaround, here is how I remove scripts with gulp-replace
The desire to remove sections probably arises for many where style sheets or scripts need to be injected in a particular order for local/debug builds and as combined/minifed for release builds. For example:
For such cases, another workaround to consider is to use a single injection tag for all script types and combine multiple streams into one stream which is passed to inject. This will also allow you to conditionally combine streams based upon environment variables, etc. The best library I’ve found for doing this is streamqueue.
Here’s an example: