question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent sort order with gulp-inject

See original GitHub issue

The order of the script tags injected into my html file is not consistent across runs, even when the files in my directory haven’t changed. My code looks like this:

gulp.src(paths.template)
  .pipe(inject(
    gulp.src(['ng/js/app/**/*.js']).pipe(angularFilesort())
  ))
  .pipe(gulp.dest(paths.templateDir));

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
ejdyksencommented, Jan 8, 2015

Globs in gulp don’t guarantee any order, so this problem comes up frequently in places where order matters in gulp.

If you sort the files first in the stream using gulp-natural-sort, gulp-angular-filesort will start doing the same thing every time.

Excerpt:

  gulp.src('app/**/*.js')
    .pipe(naturalSort())
    .pipe(angularFilesort())
    .pipe(concat('main.js'))
    .pipe(gulp.dest('build'))
1reaction
oatkillercommented, Dec 8, 2014

👍 I’m currently having the same issue. I have hundreds of commits where the order of includes has changed arbitrarily. 😦 I think the underlying issue is in toposort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to order injected files using Gulp? - Stack Overflow
I'm using Gulp. After the build completes, the *.js files are injected in the wrong order in index.html . The file main.js depends...
Read more >
gulp-inject - npm
Start using gulp-inject in your project by running `npm i ... Multiple sources when order is important ... templateString; options.sort.
Read more >
Genetec Security Center 5.10.0-Third Party Software List ...
The Documentation and Ordering Documents identify which license or ... or disclosure of Products Agreement provisions that are inconsistent with federal law ...
Read more >
API Analyzer Helps Upgrading Telerik Projects
This tool could help you determine a problematic area when upgrading your WPF, WinForms or ASP.NET Web Forms application with a newer version...
Read more >
Is Knockout.js still usable? - Quora
Prototype is sort of an extension to older javascript and would allow for OO type programming as well as some utility functions around...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found