Neutrino Minify Middleware
neutrino-middleware-minify
is Neutrino middleware for minifying source code using
BabelMinifyWebpackPlugin
. This middleware is usually only
added during production builds.
Requirements
- Node.js v6.10+
- Yarn or npm client
- Neutrino v7
Installation
neutrino-middleware-minify
can be installed via the Yarn or npm clients.
Yarn
❯ yarn add neutrino-middleware-minify
npm
❯ npm install --save neutrino-middleware-minify
Usage
neutrino-middleware-minify
can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:
// Using function middleware formatconst minify = ; // Use with default optionsneutrino; // Usage showing overriding minification optionsneutrino;
// Using object or array middleware format // Use with default optionsmoduleexports = use: 'neutrino-middleware-minify'; // Usage showing overriding minification optionsmoduleexports = use: 'neutrino-middleware-minify' minify: {} plugin: {} ;
The minify
and plugin
properties map to the options defined by
babel-minify-webpack-plugin.
Customization
neutrino-middleware-minify
creates some conventions to make overriding the configuration easier once you are ready to
make changes.
Plugins
The following is a list of plugins and their identifiers which can be overridden:
Name | Description | Environments and Commands |
---|---|---|
minify |
Minifies source code using BabelMinifyWebpackPlugin . |
all |
Contributing
This middleware is part of the neutrino-dev repository, a monorepo containing all resources for developing Neutrino and its core presets and middleware. Follow the contributing guide for details.