Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@storyous/retinajs
Advanced tools
retina.js makes it easy to serve high-resolution images to devices with retina displays
retina.js makes it easy to serve high-resolution images to devices with retina displays
When your users load a page, retina.js checks each image on the page to see if there is a high-resolution version of that image on your server. If a high-resolution variant exists, the script will swap in that image in-place.
The script assumes you use Apple's prescribed high-resolution modifier (@2x) to denote high-resolution image variants on your server. It is also possible to override this by manually specifying the URL for the @2x images using data-at2x
attributes.
For example, if you have an image on your page that looks like this:
<img src="/images/my_image.png" />
The script will check your server to see if an alternative image exists at /images/my_image@2x.png
However, if you have:
<img src="/images/my_image.png" data-at2x="http://example.com/my_image@2x.png" />
The script will use http://example.com/my_image@2x.png
as the high-resolution image. No checks to the server will be performed.
The JavaScript helper script automatically replaces images on your page with high-resolution variants (if they exist). To use it, download the script and include it at the bottom of your page.
<script type="text/javascript" src="/scripts/retina.js"></script>
You can also exclude images that have no high-res version. Simply add the data-no-retina
attribute.
<img src="/path/to/image" data-no-retina />
###LESS & SASS
The LESS & SASS CSS mixins are helpers for applying high-resolution background images in your stylesheet. You provide it with an image path and the dimensions of the original-resolution image. The mixin creates a media query specifically for Retina displays, changes the background image for the selector elements to use the high-resolution (@2x) variant and applies a background-size of the original image in order to maintain proper dimensions. To use it, download the mixin, import or include it in your LESS or SASS stylesheet, and apply it to elements of your choice. The SASS versions require you pass the extension separately from the path.
Syntax:
.at2x(@path, [optional] @width: auto, [optional] @height: auto);
@include at2x($path, [option] $ext: "jpg", [optional] $width: auto, [optional] $height: auto);
Steps:
This:
.logo {
.at2x('/images/my_image.png', 200px, 100px);
}
.logo {
@include at2x('/images/my_image', png, 200px, 100px);
}
Will compile to:
.logo {
background-image: url('/images/my_image.png');
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
.logo {
background-image: url('/images/my_image@2x.png');
background-size: 200px 100px;
}
}
FAQs
retina.js makes it easy to serve high-resolution images to devices with retina displays
The npm package @storyous/retinajs receives a total of 2 weekly downloads. As such, @storyous/retinajs popularity was classified as not popular.
We found that @storyous/retinajs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
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.