
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Lazy loaded images on rails. If you want a quick start using unveil.js with rails there is now a gem for that.
By loading your images as they appear in the viewport rather than on load you can improve your rails application's page speed.
Add the unveil-rails gem into your Gemfile
:
gem 'unveil-rails', '~> 0.2.1'
Install unveil.js and initializer into your rails app:
bin/rails g unveil:rails:install
Include the unveil.js initializer in app/assets/javascripts/application.js
:
//= require unveil_init
Now use the helper method where ever you want lazy images:
<%= lazy_image_tag('an-image.png') %>
<%= lazy_image_tag('an-image.png', retina: 'a-retina-image.png') %>
<%= lazy_image_tag('an-image.png', placeholder: 'placeholder.png') %>
The installation generator will have added an initializer to your application. In this file there are a couple of settings you can change.
Unveil::Rails.config.threshold = 200
Setting this variable to an integer will set the unveil threshold setting as documented here.
You may set an alternative default placeholder image:
Unveil::Rails.config.default_placeholder = 'default.jpg'
You can set the placeholder per lazy image by passing in the placeholder option:
<%= lazy_image_tag('an-image.png', placeholder: 'placeholder.png') %>
Developed and maintained by Made Tech. Key contributions:
And of course Luís Almeida creator of unveil.js.
Copyright © 2014 Made Tech Ltd. It is free software, and may be redistributed under the terms specified in the LICENSE file.
FAQs
Unknown package
We found that unveil-rails 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.