All files are in reverse order
cluka opened this issue · 4 comments
if i run this task:
gulp.task('test',
function () {
return gulp.src(['./app/**/*.js']).pipe(angularFilesort()).pipe(filelog());
});
i get js files in reverse order. Ie. my app.js is at the last position instead of first. etc.
I have the same issue... this is driving me nuts!
var injectOpts = {addRootSlash: false};
var injectStyles = gulp.src(['./src/**/*.css'], {read: false});
var injectScripts = gulp.src(['./src/app/**/*.js']).pipe(angularFilesort());
return target.pipe(inject(injectStyles, injectOpts))
.pipe(inject(injectScripts, injectOpts))
.pipe(wiredep())
.pipe(useref({
searchPath: ['bower_components', './']
}))
.pipe(gulpif('*.js', uglify()))
.pipe(gulpif('*.css', minifyCss()))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest('./dist'));
Files are ordered in reverse with app.js as the last file in the bundle. If I take out useref, the individual (unbundled) file script tags are also in reverse order.
This is ridiculous, but my fix for this issue is to run angularFileSort twice.
.pipe($.angularFilesort()).pipe($.angularFilesort());
Seems I have this issue too.Here is my code gist:
Throw angular is not defined
Error:
And, like @seanmarthur said, run angularFileSort twice will solve the problem.
You shouldn't pass external dependencies (i.e. 3rd party libs) through this plugin! See this comment on #8.
See #45 as well, perhaps you don't have to use this plugin at all? Have you tried commenting it out and do you get errors then?