Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

All files are in reverse order #44

Open
cluka opened this issue Mar 6, 2016 · 4 comments
Open

All files are in reverse order #44

cluka opened this issue Mar 6, 2016 · 4 comments

Comments

@cluka
Copy link

cluka commented Mar 6, 2016

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.

@seanmarthur
Copy link

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.

@seanmarthur
Copy link

This is ridiculous, but my fix for this issue is to run angularFileSort twice.

.pipe($.angularFilesort()).pipe($.angularFilesort());

@mrdulin
Copy link

mrdulin commented Mar 16, 2016

Seems I have this issue too.Here is my code gist:
image

image

image

Throw angular is not defined Error:
image

And, like @seanmarthur said, run angularFileSort twice will solve the problem.

correct order:
image

clear
image

@joakimbeng
Copy link
Member

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?

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

No branches or pull requests

4 participants