Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
npm install abridge
Abridge is a wild fork of node-minify module. It is not a drop-in replacement, but improves upon the original code in various ways.
The old API style is mostly preserved.
var Minifier = require('abridge').Minifier;
var minifier = new Minifier({
type: 'yui',
fileIn: 'public/js/base.js',
fileOut: 'public/js/base-min.js',
callback: function(err){
console.log(err);
}
});
minifier.compress();
But now we can just call the minify
function without creating an instance of Minify:
var abridge = require('abridge');
var options = {
type: 'yui',
fileIn: 'public/js/base.js',
fileOut: 'public/js/base-min.js',
callback: function(err){
console.log(err);
}
};
abridge.minify(options);
We can also supply a callback as a second argument, as per tradition:
var options = {
type: 'yui',
fileIn: 'public/js/base.js',
fileOut: 'public/js/base-min.js'
};
abridge.minify(options, function(err) {
console.log(err);
});
And our callback is given the minified data:
abridge.minify(options, function(err, data) {
console.log(err, data);
});
Also fileOut
and type
are optional. If CSS is detected, Abridge will default to YUICompressor, as uglifyjs compresses only JavaScript. However, if minifying JavaScript, Abridge will use Uglify-js instead, as it is more efficient:
var options = {
fileIn: 'public/js/base.js'
};
abridge.minify(options, console.log);
In fact you no longer need an options object:
var fileIn = ['public/js/base.js', 'public/js/somn.js'];
var fileOut = 'public/js/common.js';
abridge.minify(fileIn, fileOut, console.log);
In the simplest case, we have:
abridge.minify('public/js/base.js', function(err, data) {
});
The function also returns a pipeable Stream instance:
var http = require('http');
var server = new http.Server();
server.addListener('request', function(req, res) {
var url = req.url;
if (/^\/files/.test(url)) {
url = url.substring(1);
abridge.minify(url).pipe(res);
};
});
But this would be absurdly inefficient without file caching. See Lactate for that.
To use YUICompressor (default for CSS files) you must have Java installed.
FAQs
Streaming minifier for JS and CSS
The npm package abridge receives a total of 78 weekly downloads. As such, abridge popularity was classified as not popular.
We found that abridge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.