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 in specific order; not alphabetically #182

Open
utdrmac opened this issue Dec 18, 2017 · 1 comment
Open

concat in specific order; not alphabetically #182

utdrmac opened this issue Dec 18, 2017 · 1 comment

Comments

@utdrmac
Copy link

utdrmac commented Dec 18, 2017

I'm using "grunt-contrib-concat": "^1.0.1". Here's gruntfile parts:

concat: {
  options: { separator: ';' },
  dist: {
    src: [
      'node_modules/jquery/dist/jquery.min.js',
      'node_modules/bootstrap/dist/js/bootstrap.min.js',
      'baller.js',
    ],
    dest: 'app.js'
  }
},

When I do more app.js on CLI, I am expecting see "jquery.min.js" first, then "bootstrap.min.js" next, then "baller.js" last. But "baller.js" is always first, followed by bootstrap, then jquery.

If you change baller.js to "zzz.js", then "zzz.js" is the last part of app.js

Why is grunt-concat not honoring the file names order?

@rquadling
Copy link

rquadling commented Jan 3, 2018

We had the same issue. Our solution was to not use the globbing in concat.

This is one of my concat setups..

            customer_js: {
                options: {
                    sourceMap: false
                },
                src: customerJsSources,
                dest: 'public/js/customer.js'
            },

customerJsSources is ...


    var customerJsSources =
        [].concat(
            commonJsSourcesStart,
            ['src/customer/js/routes.js'],
            commonJsSourcesEnd,
            Glob.sync('src/customer/js/**/*.js', {nocase: true}),
            ['src/customer/js/4-run.js']
        );

Explicit ordering. Hundreds of files concatenated in the correct order.

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