Skip to content

Teamwork/gulp-path-length

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

gulp-path-length

NPM version Build Status Windows Build Status Dependency Status


A Gulp plugin for enforcing a character limit on file paths. Created with Windows' 256 character limit in mind but can be used on other platforms too.

Installation

npm install gulp-path-length

Usage

var gulp = require('gulp');
var pathLength = require('gulp-path-length');

gulp.task('default', function(){
    gulp.src('./example/path/to/directory/**', {read: false})
        .pipe(pathLength()); 
});

This will stop the build with an error if you've an overly long path. I've passed {read: false} to gulp.src here because we don't need to read the contents, we just need the paths. But if you're using gulp-path-length after some other pipes, it's likely you shouldn't pass {read: false}.

API

There is only one (optional) parameter; an options object. The possible properties it can contain are:

  • maxLength - defaults to 256
  • rewrite - This is an optional object which should contain match and replacement properties which contains mappings between directories. So for example:
rewrite: {
    match: './example/path/to/directory/',
    replacement: 'C:\\Program Files (x86)\\abc'
}

When the plugin goes to check the file ./example/path/to/directory/x.txt, it will actually check C:\Program Files (x86)\abc\x.txt.

  • rewrite.match accepts a path to resolve (like ./example), relative (example/a) or absolute paths (C:\a).
  • rewrite.replacement only accepts an absolute path.

About

A Gulp plugin for enforcing a character limit on file paths

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published