🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
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
npm
Version published
Weekly downloads
167
53.21%
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