gulp-order icon indicating copy to clipboard operation
gulp-order copied to clipboard

Way to specify 'the rest'?

Open mcblum opened this issue 9 years ago • 6 comments
trafficstars

Trying to get jQuery to load first so the rest of its dependencies will work. The issue is I'm using this in conjunction with main-bower-files. Is there a way to say: load jQuery first and then put everything else after that?

Thank you! Matt

mcblum avatar Jan 19 '16 17:01 mcblum

I'm doing something very similar.

var dependencies = gulp.src(mainBowerFiles('**/*'), { read: false })
    .pipe(order([
      'normalize.css'
    ]));

trying to get normalize to order first while respecting the original sort order, which doesn't seem to be working... Any progress on this?

Nate-Wilkins avatar May 25 '16 14:05 Nate-Wilkins

gulp.task('js', function() {
    return gulp.src(mainBowerFiles('**/*.js').concat(['src/**/*.js'])
        .pipe(order([
            "**/jquery.js", "**/app.js", "**/*.js"
        ]))
        .pipe(uglify())
        .pipe(concat('min.js'))
        .pipe(gulp.dest('./dist/js'))
        .on('end', reload);
});

That should work for you guys. Let me know if you're still interest/have any problems with it and I can offer some help. It took me a while to figure it out on my own.

gulp-order seems to work perfectly fine the docs just aren't the most clear on how to get this to work.

Gobd avatar May 26 '16 18:05 Gobd

So in my example it would look something like

var dependencies = gulp.src(mainBowerFiles('**/*'), { read: false })
    .pipe(order([
      '**/normalize.css',
      '**/*'
    ]));

Nate-Wilkins avatar Jun 08 '16 19:06 Nate-Wilkins

Yes that would probably work, I've never done it without file extensions but it looks good.

Gobd avatar Jun 08 '16 19:06 Gobd

Yeah that worked, thanks!

Nate-Wilkins avatar Jun 16 '16 12:06 Nate-Wilkins

Hi guys, hi @Gobd This way does not work as I expected, so anyone can lend a hand please:

function minifyJS() { return src('src/js/**/*.js') .pipe(order([ 'src/js/jquery.js', 'src/js/**/*.js', 'src/js/script.js' ])) .pipe(concat('bundle.js')) .pipe(terser()) .pipe(dest('dist/js')); }

arafat-amin avatar Feb 20 '24 20:02 arafat-amin