Skip to content

Instantly share code, notes, and snippets.

@yields
Created October 27, 2013 01:06
Show Gist options
  • Save yields/7176705 to your computer and use it in GitHub Desktop.
Save yields/7176705 to your computer and use it in GitHub Desktop.
var rework = require('rework');
var stdin = require('stdin');
var gm = require('gm');
stdin(function(str){
rework(str)
.use(rework.at2x())
.use(rework.url(retina))
.toString();
});
function retina(url){
if (!url.contains('@2x')) return;
var retinaPath = url;
var real = remove('@2x', retinaPath);
var path = resolve(real);
gm(path)
.size(realWidth / 2)
.write(resolve(url), function(){});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment