Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-sort

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-sort

Sort files in stream by path or any custom sort comparator

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
329K
decreased by-2.96%
Maintainers
1
Weekly downloads
 
Created

What is gulp-sort?

The gulp-sort npm package is a Gulp plugin that allows you to sort files in a stream. This can be useful for ensuring that files are processed in a specific order, such as sorting JavaScript files alphabetically or by a custom comparator function.

What are gulp-sort's main functionalities?

Sort files alphabetically

This feature allows you to sort files alphabetically. The code sample demonstrates how to use gulp-sort to sort JavaScript files in the 'src' directory and output them to the 'dist' directory.

const gulp = require('gulp');
const sort = require('gulp-sort');

gulp.task('sort-files', function() {
  return gulp.src('src/**/*.js')
    .pipe(sort())
    .pipe(gulp.dest('dist'));
});

Sort files with a custom comparator

This feature allows you to sort files using a custom comparator function. The code sample demonstrates how to use gulp-sort with a custom comparator to sort JavaScript files in the 'src' directory and output them to the 'dist' directory.

const gulp = require('gulp');
const sort = require('gulp-sort');

gulp.task('sort-files-custom', function() {
  return gulp.src('src/**/*.js')
    .pipe(sort({
      comparator: function(file1, file2) {
        return file1.path.localeCompare(file2.path);
      }
    }))
    .pipe(gulp.dest('dist'));
});

Other packages similar to gulp-sort

Keywords

FAQs

Package last updated on 15 Feb 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc