Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

a browserify plugin that runs various optimizations, so you don't have to install them all manually. makes your bundles tiny!

License

NotificationsYou must be signed in to change notification settings

browserify/tinyify

Repository files navigation

a browserify plugin that runs various optimizations, so you don't have to install them all manually.

npmtravisstandard

npm install --save-dev tinyifybrowserify -p tinyify app.js

Included

browser-pack-flat andbundle-collapser are both not used if the--full-paths option is passed to Browserify.This way you can still get all of tinyify's other optimizations when building fordisc.

Options

Options can be provided on the command line using subarg syntax, or in a separate options object using the browserify API.

env: {}

Supply custom environment variables for@browserify/envify.

b.plugin('tinyify',{env:{PUBLIC_PATH:'https://mywebsite.surge.sh/'}})

This option is only available in the API.On the CLI, you can define environment variables beforehand instead:

PUBLIC_PATH=https://mywebsite.surge.sh browserify app.js -p tinyify

--no-flat,flat: false

Disablebrowser-pack-flat.This enablesbundle-collapser instead which will still shrink the output bundle a bit by replacing file paths with short module IDs.

browserify app.js -p [ tinyify --no-flat ]
b.plugin('tinyify',{flat:false})

More options?

If you need further customisation, I recommend installing the tools separately instead:

npm install --save-dev unassertify @browserify/envify @browserify/uglifyify common-shakeify browser-pack-flat terserbrowserify entry.js \  -g unassertify \  -g @browserify/envify \  -g @browserify/uglifyify \  -p common-shakeify \  -p browser-pack-flat/plugin \| terser -cm \> output.js

Or with the Node API:

browserify('entry.js').transform('unassertify',{global:true}).transform('@browserify/envify',{global:true}).transform('@browserify/uglifyify',{global:true}).plugin('common-shakeify').plugin('browser-pack-flat/plugin').bundle().pipe(require('minify-stream')({sourceMap:false})).pipe(fs.createWriteStream('./output.js'))

Alternatively you can fork this repo and publish it on npm under a scope with your modifications.

License

Apache-2.0

About

a browserify plugin that runs various optimizations, so you don't have to install them all manually. makes your bundles tiny!

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp