Skip to content

Commit

Permalink
Create new gulp task for generating default browser builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Marak committed Aug 23, 2020
1 parent 22f8dba commit c752dac
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions build/gulp-tasks/browser.js
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/'));
};

0 comments on commit c752dac

Please sign in to comment.