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

styledump-diff

v0.0.2

Published

compare the similarity of two or more styledump'ed webpages

Downloads

6

Readme

styledump-diff

styledump-diff was written to do quick similarity comparisons between a series of styledump outputs. It calculates the Jaccard index between two neighboring objects in a JSONLines file and output it as CSV.

Installation

npm install -g styledump-diff

Usage (Command line)

First install styledump to collect the styledumps of a few web archive snapshots. >> example.com.jsonl simply appends the output of styledump to the file example.com.jsonl, thus generating a JSONLines file.

> styledump http://web.archive.org/web/2009/http://www.example.com/ >> example.com.jsonl
> styledump http://web.archive.org/web/2014/http://www.example.com/ >> example.com.jsonl
> styledump http://web.archive.org/web/2019/http://www.example.com/ >> example.com.jsonl

Then invoke stylediff to generate a CSV file that compares the style attributes using the Jaccard index (1 = identity, 0 = complete dissimilarity)

stylediff --columns "font-family,color,line-height,background" "example.com.jsonl"

(NOTE: stylediff is the executable program provided by the styledump-diff package)

example output:

URL 1,URL 2,AVERAGE SIMILARITY,font-family,color,line-height,background
http://web.archive.org/web/20091231215808/http://www.example.com/,http://web.archive.org/web/20150101000457/http://www.example.com/,0.5833333333333333,0,0.3333333333333333,1,1
http://web.archive.org/web/20150101000457/http://www.example.com/,http://web.archive.org/web/20190901174525/https://example.com/,1,1,1,1,1

Command Line Interface

Usage: stylediff [options] <jsonlfile>

compare the similarity of two or more styledump'ed webpages and output them as CSV

Options:
  -V, --version               output the version number
  -r, --reduce                reduce CSS property values by removing dead values, alternate font-families and fractional digits for pixel values.
  -c, --columns <columnlist>  comma-separated list of CSS properties in the CSV output (default: all)
  -h, --help                  output usage information

The -r option tries to remove irrelevant (parts) of CSS property values before performing the comparison. Examples:

| Before Removal | After Removal | Description | | --- | --- |---| | "font-family":["Georgia, \"Times New Roman\", Times, serif","Arial", "Arial, sans-serif"] | "font-family":["Georgia","Arial"] | Fallback font families are rarely effective in the age of web fonts. By removing them, we get a more accurate number of the used font-families | | "border":["0px solid #595959","1px solid #C8C8C8","none","0"] | "border":["1px solid #C8C8C8"] | zero-pixel or "none" borders are not visible, so they shouldn't be counted as border style | | "margin-top": ["80px", "21.44px", "21px", "0px"] |"margin-top": ["80px", "21px", "0px"] | dimensions specified in units other than pixel sometimes lead to fractional digits, which have no relevance for the page display. |

License

ISC