Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 610 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does gulp.src not like being passed an array of complete paths to files?

#1
I'm attempting to pass gulp.src an array of files that I want it to deal with. This is the array as it stands.

['bower_components/jquery/jquery.js',
'bower_components/superscrollorama/js/greensock/TweenMax.min.js',
'bower_components/superscrollorama/jquery.superscrollorama.js' ]

I'm finding though that gulp.src doesn't seem to like that and the third element doesn't make it through into the end destination.

I've found that everything works fine when I introduce some wildcard characters like this:

['bower_components/**/jquery.js',
'bower_components/**/js/greensock/TweenMax.min.js',
'bower_components/**/jquery.superscrollorama.js' ]

But why? Something to do with the way globbing works? I've googled but can't find out.

Maybe this isn't the intended purpose of globbing but it doesn't make sense to me that it should work this way. Can anyone shed some light?
Reply

#2
When you pass in an array of full paths, each file is processed independently. The globbing doesn't know where the root of the path is (in fact, it guesses based on the first glob). Therefore, each file is rooted in the folder it contains, and the relative path is empty.

However, there is an easy solution. Pass an object with the key `base` as the second argument to `gulp.src`, and everything will have the correct relative path:

<!-- language: lang-js -->

return gulp.src(['bower_components/jquery/jquery.js',
'bower_components/superscrollorama/js/greensock/TweenMax.min.js',
'bower_components/superscrollorama/jquery.superscrollorama.js' ],
{base: 'bower_components/'})
.pipe(...);
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through