node-minify
was splitted into small packages.
- uninstall old version
npm remove node-minify
- install the
core
package
npm install @node-minify/core
- install the compressor
npm install @node-minify/uglify-js
- usage
const minify = require('@node-minify/core');
const uglifyJS = require('@node-minify/uglify-js');
minify({
compressor: uglifyJS,
input: 'foo.js',
output: 'bar.js',
callback: function(err, min) {}
});
yui-js
and yui-css
was removed, a type option must be use instead
var compressor = require('node-minify');
compressor.minify({
compressor: 'yui-js',
input: 'foo.js',
output: 'bar.js',
callback: function(err, min) {}
});
var compressor = require('node-minify');
compressor.minify({
compressor: 'yui-css',
input: 'foo.css',
output: 'bar.css',
callback: function(err, min) {}
});
const minify = require('@node-minify/core');
const yui = require('@node-minify/yui');
minify({
compressor: yui,
type: 'js',
input: 'foo.js',
output: 'bar.js',
callback: function(err, min) {}
});
const minify = require('@node-minify/core');
const yui = require('@node-minify/yui');
minify({
compressor: yui,
type: 'css',
input: 'foo.css',
output: 'bar.css',
callback: function(err, min) {}
});
- No need to instantiate anymore
new compressor.minify()
to compressor.minify()
- type was renamed to compressor
{ type: 'gcc' }
to { compressor: 'gcc' }
- fileIn was renamed to input
{ fileIn: 'foo.js' }
to { input: 'foo.js' }
- fileOut was renamed to output
{ fileOut: 'bar.js' }
to { output: 'bar.js' }
var compressor = require('node-minify');
new compressor.minify({
type: 'gcc',
fileIn: 'public/js/base.js',
fileOut: 'public/js-dist/base-min-gcc.js',
callback: function(err, min) {}
});
var compressor = require('node-minify');
compressor.minify({
compressor: 'gcc',
input: 'foo.js',
output: 'bar.js',
callback: function(err, min) {}
});