1.0.0 • Published 8 years ago
grunt-file-order v1.0.0
grunt-file-order
A grunt extension for ordering files after selection.
Adds order attribute to both config files and grunt.file.expand.
Installation
$ npm install --save grunt-file-orderUsage
In config files
require('grunt-file-order'); // global addition to grunt
module.exports = function (grunt, options) {
return {
copyFiles: {
files: [
{
expand: true,
src: ['<%= sourcedir %>**'],
dest: '<%= outputdir %>',
order: function(filepaths) {
// sort alphabetically
return filepaths.sort(function(a,b) {
return a>b ? 1 : a<b ? -1 : 0;
});
}
}
]
}
};
};In task grunt.file.expand
require('grunt-file-order'); // global addition to grunt
var sourcedir = "./src";
var files = grunt.file.expand({
order: function(filepaths) {
// sort alphabetically
return filepaths.sort(function(a,b) {
return a>b ? 1 : a<b ? -1 : 0;
});
}
}, sourcedir);1.0.0
8 years ago