Last active
August 29, 2015 14:20
-
-
Save seleckis/e669f76f3fa80b565f49 to your computer and use it in GitHub Desktop.
String method to return retina filenames
This file contains hidden or 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
String.prototype.retina = function () { | |
return this.replace(/(\.\w+$)/, "@2x$1"); | |
}; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>String Prototype Retina</title> | |
<script src="String.prototype.retina.js" charset="utf-8"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var filename = "logo.png"; | |
document.write(filename.retina()); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment