npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

respimg-inspector

v0.2.5

Published

A javascript plugin to check responsive images in the browser.

Downloads

3

Readme

RespImg Inspector

RespImg Inspector is a javascript plugin to check responsive images in the browser. This plugin intends to help you implement responsive images' best practices.

Build Status GitHub version npm version Bower version

By adding this script to a page, it will add layers over images and check their responsiveness status. Those status can be good, warning or bad:

  • Status is good when image is perfectly sized at the correct DPI.
  • Status is warning when the delivered image is larger than it should be.
  • Status is bad when the delivered image is smaller than it should be.

Why does it matter ?

By delivering too large images (the warning case), providers and clients consume more network bandwidth than they should and slow-down page load time. Furthermore, by using a fluid images approach (ie. max-width: 100%), you delegate the downscaling task to the browser which means more CPU, more memory. This can have an impact the user experience and the situation is of course even worse on mobiles where it often means janks, crashes and less battery life.

By delivering too small images (the bad case), you get some of the drawbacks above plus an ugly user experience because of the upscale.

Features

  • Handle img and elements with background images (only elements with a background-size set to cover for now)
  • Live react to changes in the DOM (window resize, added/updated elements)
  • Handle device pixel ratio

Install

From source file:

  • dist/respimg-inspector.js
  • dist/respimg-inspector.min.js

Or install via Bower: bower install respimg-inspector

Or install via npm: npm install respimg-inspector

Usage

<script src="respimg-inspector.min.js"></script>

By default, all document's nodes are processed except those:

span, em, strong, i, b, big, small, tt, abbr, script, br, hr, sub, sup, button, input, label, select, textarea, samp, var, iframe, script, video, object, canvas, center, font, frame, frameset, noframe, noscript, option, strike, s, wbr, bdi, kbd, audio, map, area, track, embed, param, source, del, ins, acronym, applet, blink, dir, spacer, isindex, content, element, shadow, template, noembed, head, meta, link, title, style, html

To restrict the scope, you can filter with custom selectors:

<script>
var respImgInspectorSelectors = "img";
</script>

Or

<script>
var respImgInspectorSelectors = ".myclass, img";
</script>

You can customize how RespImg Inspector's overlays look by adding your own stylesheet. Here are the css of the demo.

.respimg-inspector-overlay::before {
  display: block;
  padding: 20px;
  font-family: monospace;
  font-size: 9px;
  color: #fff;
  content: "tag: " attr(data-el-tag) " - width: " attr(data-img-width) "px - height: " attr(data-img-height) "px - natural width: " attr(data-img-natural-width) "px - natural height: " attr(data-img-natural-height) "px";
}

.respimg-inspector-warning {
  background-color: rgba(252, 176, 49, .7);
}

.respimg-inspector-bad {
  background-color: rgba(252, 86, 61, .7);
}

.respimg-inspector-good {
  background-color: rgba(185, 237, 67, .7);
}