🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
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

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
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