项目作者: WaveHack

项目描述 :
Gulp plugin to recursively flatten JS files into a single directory
高级语言: JavaScript
项目地址: git://github.com/WaveHack/gulp-dot-flatten.git
创建时间: 2017-03-10T21:56:37Z
项目社区:https://github.com/WaveHack/gulp-dot-flatten

开源协议:MIT License

下载


gulp-dot-flatten

Build Status
Dependency Status
Downloads
NPM version
License

gulp-dot-flatten is a gulp plugin to recursively flatten JS files into a single directory.

About

Will rewrite the following filenames when used with the usage example below:

  1. /build/Main.js
  2. /build/Foo/Bar.js
  3. /build/Foo/Bar/Baz.js

Into this:

  1. /dist/Main.js
  2. /dist/Foo.Bar.js
  3. /dist/Foo.Bar.Baz.js

Any require('./foo/bar') will be rewritten into require('./foo.bar').

This library is made specifically for usage with Screeps due to its lack of directory support.

Install

npm install --save-dev gulp-dot-flatten

Usage

  1. var dotFlatten = require('gulp-dot-flatten');
  2. gulp.task('flatten', () => {
  3. return gulp.src('./build/**/*.js')
  4. .pipe(dotFlatten())
  5. .pipe(gulp.dest('./dist'));
  6. });

Options

dotFlatten(options)

options.stringFilter

Type: Function

Optional function in which the filename will pass through. Useful for things like forcing lowercase filenames, if desired.

Example:

  1. var dotFlatten = require('gulp-dot-flatten');
  2. gulp.task('flatten', () => {
  3. return gulp.src('./build/**/*.js')
  4. .pipe(dotFlatten({
  5. stringFilter: (str) => str.toLowerCase()
  6. }))
  7. .pipe(gulp.dest('./dist'));
  8. });

options.verbose

Type: Boolean
Default: false

Attribution

gulp-dot-flatten is based on the inline library of the same name found in the Screeps TypeScript Starter Kit.

Original authors and contributors:

License

gulp-dot-flatten is open-sourced software licensed under the MIT License.