UNPKG

uppy

Version:

Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:

40 lines (33 loc) 893 B
const fs = require('fs') const path = require('path') const { PassThrough } = require('stream') const browserify = require('browserify') const babelify = require('babelify') const minify = require('minify-stream') const disc = require('disc') const outputPath = path.join(__dirname, '../website/src/disc.html') function minifyify () { return minify({ sourceMap: false, toplevel: true, compress: { unsafe: true } }) } const bundler = browserify(path.join(__dirname, '../src/index.js'), { fullPaths: true, standalone: 'Uppy' }) bundler.transform(babelify) bundler.transform(minifyify, { global: true }) bundler.bundle() .pipe(disc()) .pipe(prepend('---\nlayout: false\n---\n')) .pipe(fs.createWriteStream(outputPath)) .on('error', (err) => { throw err }) function prepend (text) { const stream = new PassThrough() stream.write(text) return stream }