https://github.com/wavehack/gulp-dot-flatten
Gulp plugin to recursively flatten JS files into a single directory
https://github.com/wavehack/gulp-dot-flatten
gulp-plugin screeps
Last synced: 3 months ago
JSON representation
Gulp plugin to recursively flatten JS files into a single directory
- Host: GitHub
- URL: https://github.com/wavehack/gulp-dot-flatten
- Owner: WaveHack
- License: mit
- Created: 2017-03-10T21:56:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-11T23:56:20.000Z (over 9 years ago)
- Last Synced: 2025-03-15T04:03:33.137Z (over 1 year ago)
- Topics: gulp-plugin, screeps
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# gulp-dot-flatten
[](https://travis-ci.org/WaveHack/gulp-dot-flatten)
[](https://gemnasium.com/github.com/WaveHack/gulp-dot-flatten)


[](https://opensource.org/licenses/MIT)
gulp-dot-flatten is a [gulp](https://github.com/gulpjs/gulp) plugin to recursively flatten JS files into a single directory.
## About
Will rewrite the following filenames when used with the [usage](#usage) example below:
```
/build/Main.js
/build/Foo/Bar.js
/build/Foo/Bar/Baz.js
```
Into this:
```
/dist/Main.js
/dist/Foo.Bar.js
/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](https://screeps.com/) due to its lack of directory support.
## Install
`npm install --save-dev gulp-dot-flatten`
## Usage
```js
var dotFlatten = require('gulp-dot-flatten');
gulp.task('flatten', () => {
return gulp.src('./build/**/*.js')
.pipe(dotFlatten())
.pipe(gulp.dest('./dist'));
});
```
## 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:
```js
var dotFlatten = require('gulp-dot-flatten');
gulp.task('flatten', () => {
return gulp.src('./build/**/*.js')
.pipe(dotFlatten({
stringFilter: (str) => str.toLowerCase()
}))
.pipe(gulp.dest('./dist'));
});
```
#### options.verbose
Type: `Boolean`
Default: `false`
## Attribution
gulp-dot-flatten is based on the [inline library](https://github.com/screepers/screeps-typescript-starter/blob/master/libs/gulp-dot-flatten.js) of the same name found in the [Screeps TypeScript Starter Kit](https://github.com/screepers/screeps-typescript-starter).
Original authors and contributors:
- [resir014](https://github.com/resir014)
- [valerian](https://github.com/valerian)
- [ratuple](https://github.com/ratuple)
- [ags131](https://github.com/ags131)
## License
gulp-dot-flatten is open-sourced software licensed under the [MIT License](https://opensource.org/licenses/MIT).