Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Option no-sort doesn't seem to work on gulp 5.0.0 #2784

Closed
tallenglish opened this issue Apr 7, 2024 · 5 comments · Fixed by #2786
Closed

Option no-sort doesn't seem to work on gulp 5.0.0 #2784

tallenglish opened this issue Apr 7, 2024 · 5 comments · Fixed by #2786

Comments

@tallenglish
Copy link

What were you expecting to happen?

Only changing between gulp v4.0.2 and v5.0.0 (all other plugins stay the same and latest versions).

Issue is only really a problem for JavaScript files where the order of the files being concat is vital for plugins that depend on others - like jQuery needing to be first.

I am using ESM gulpfile, as required by latest gulp-autoprefixer v9.0.0 now.

Using the following to keep the order of input sources unsorted (mainly required for JavaScript dependencies).

What actually happened?

Works as expected for gulp v4.0.2 with "no-sort" option, however array is still sorted when using v5.0.0 with same option.

Please give us a sample of your gulpfile

return gulp.src(src, { "no-sort": true })
	.pipe(gulp_concat(file))
	.pipe....

In this case the src is an array of files similar to the following, and need to be concat in the same order:

const src = [
	"a.js",
	"b.js",
	"c.js",
	"d.js"
];

Only change needed to break is upgrading from gulp v4.0.2 to v5.0.0

Terminal output / screenshots

None

Please provide the following information:

  • OS & version: Debian Linux bookworm (all latest updates)
  • node version (run node -v): 20.11.0
  • npm version (run npm -v): 10.5.1
  • gulp version (run gulp -v): 5.0.0

Additional information

None

@tallenglish
Copy link
Author

I have tried using gulp-order plugin to fix the order in a pipe after gulp.src, however it doesn't seem to work either on v5.0.0, or has no effect at least.

@tallenglish
Copy link
Author

One final note I forgot to mention, the documentation says the option is "nosort" (no dash), I tried that and it didn't work on either v4.0.2 or v5.0.0. I found the dash option from other documentation.

@cotarr
Copy link

cotarr commented Apr 7, 2024

I'm seeing the same. When given an array of ["path/filename.js", ...], the output from gulp.src appears sorted in alphabetical order using the base filename without the leading path.

I never needed the "nosort" option with gulp 4.02. I also tried src options no-sort, nosort, and noSort without success.

@BotKarma46

This comment was marked as outdated.

@phated
Copy link
Member

phated commented Apr 8, 2024

In gulp 5, we no longer use node-glob as our globbing library. I've removed the options that looked exclusive to that library in #2786 and added docs for created an ordered stream in #2788

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants