forked from zuriby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new gulp task for generating default browser builds
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
this task will generate the faker.js and faker.min.js browser bundles | ||
these bundles will contain all faker.js locales | ||
*/ | ||
|
||
const browserify = require('browserify'); | ||
const source = require('vinyl-source-stream'); | ||
const buffer = require('vinyl-buffer'); | ||
const uglify = require('gulp-uglify'); | ||
const rename = require('gulp-rename'); | ||
const { src, dest } = require('gulp'); | ||
|
||
const files = { | ||
jsMain: './index.js', | ||
jsOutput: 'faker.js' | ||
} | ||
|
||
module.exports = function browser () { | ||
return browserify(files.jsMain, { | ||
standalone: 'faker', | ||
debug: true | ||
}) | ||
.bundle() | ||
.pipe(source(files.jsOutput)) | ||
.pipe(buffer()) | ||
.pipe(dest("examples/browser/js")) | ||
.pipe(dest('dist/')) | ||
.pipe(rename({ extname: ".min.js" })) | ||
.pipe(uglify()) | ||
.pipe(dest("examples/browser/js")) | ||
.pipe(dest('dist/')); | ||
}; | ||
|