Search code examples
gruntjsgrunt-contrib-concat

Grunt concat specific file first, then all remaining files


I'm relatively new to grunt and I'm working to concat my files. I've been digging and haven't been able to come up with a good answer for this:

concat({
    src : ['file1.js', ...all other files... ],
    dest : 'dist/build.js'
});

Where file1.js is always added first, then it pulls in all remaining files. I could do it all by hand, but in the spirit of automation I was hoping to find a more dynamic method.


Solution

  • src is just a simple array which you can of course fill dynamically. e.g. you can read the files manually, sort them by whatever you want, and add that array to your config!