Created
October 27, 2013 01:06
-
-
Save yields/7176705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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