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

concat order not working gulp4 #153

Closed
miguelventura opened this issue Aug 24, 2020 · 2 comments
Closed

concat order not working gulp4 #153

miguelventura opened this issue Aug 24, 2020 · 2 comments

Comments

@miguelventura
Copy link

I'm trying to migrate for Gulp 4 and since that, gulp ignore the src files ordering. Also i've trying gulp-order but it still the same.
This is how my gulp file looks:

Gulp version: 4.0.2

function scripts() {
    return src(['./resources/js/**/*.js', './resources/js/formvalid.js', './resources/js/main.js'])
        .pipe(plumber())
        .pipe(concat('scripts.js'))
        .pipe(uglify())
        .pipe(dest(dist));
}
exports.scripts = scripts;

Can you help me to fix this?

@phated
Copy link
Member

phated commented Sep 14, 2020

What happens if you remove plumber? That module shouldn't be used with gulp 4, and instead you should be using stream.pipeline from node core like:

function scripts() {
    return stream.pipeline(
        src(['./resources/js/**/*.js', './resources/js/formvalid.js', './resources/js/main.js']),
        concat('scripts.js'),
        uglify(),
        dest(dist),
    ]);
}
exports.scripts = scripts;

Be aware that stream order is only guaranteed between each glob pattern and not inside a glob itself since your filesystem is traversed async while performing the glob itself.

@miguelventura
Copy link
Author

Thanks @phated,
The problem was exactly at the first glob './resources/js/**/*.js' is calling the other 2 files and is duplicating that.

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

2 participants