Socket
Socket
Sign inDemoInstall

tinyify

Package Overview
Dependencies
124
Maintainers
40
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tinyify

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


Version published
Weekly downloads
9.2K
increased by13.54%
Maintainers
40
Install size
20.4 MB
Created
Weekly downloads
 

Changelog

Source

4.0.0

  • Remove unused dependencies.
  • Update unassertify to 2.x.
  • Use @browserify/envify. It's the same as @goto-bus-stop/envify, just renamed.
  • Use @browserify/uglifyify, with support for more modern ES features.

Readme

Source

tinyify

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

npm travis standard

npm install --save-dev tinyify

browserify -p tinyify app.js

Included

browser-pack-flat and bundle-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 for disc.

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

Disable browser-pack-flat. This enables bundle-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 terser
browserify 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

Keywords

FAQs

Last updated on 16 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc