You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

grunt-file-order

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-file-order

Helpers for ordering files

1.0.0
latest
npmnpm
Version published
Weekly downloads
207
10.7%
Maintainers
1
Weekly downloads
 
Created
Source

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-order

Usage

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);

FAQs

Package last updated on 09 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts