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

arjan-optimize

v0.6.6

Published

a single command to optimize all your static assets. Uses several popular modules and also has a couple of cool features of its own.

Downloads

7

Readme

License Build Status

Arjan Optimize

Intro

Arjan Optimize helps you optimize all of your static assets with a single command. It takes into account several of the modern web dev directives and uses some of the most popular node modules for minification/compression of assets with a couple of neat features of its own. For more info read the docs

How it works

Arjan optimize scans your current directory recursively and for each file with a different module depending on the files MIME type. Arjan Optimize uses:

Formats supported

| Input | Module used | Output | options | reason used | | --------- | --------------- | ---------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | html | html-minifier | html | options | best compression | | css | csso | css | options | best overall size+speed+compression | | js | terser | js | Parse, Compress, Mangle | support for ES6, best speed & compression | | svg | svgo | svg | options | most widely used open source option | | jpeg | sharp | jpeg | options | fastest option | | png | sharp | png | options | fastest option | | webp | sharp | webp | options | fastest option | | gif | sharp | png | options | fastest option | | tiff | sharp | tiff | options | fastest option |

Webp Images

The webp option in Arjan Optimize does 2 things:

  1. converts all your images to webp using sharp and saves them (without overwritting images in original format)
  2. In the HTML files, it replaces each img tag with a picture tag that holds both its original compressed version and its webp version.

Because webp is a relatively new format, it is not supported by all browsers. The picture tag is a solution that allows unsupported browsers to fall back to the original version of the image. This article goes more in depth on webp and the picture tag.

suppose we have the following image tag:

<img src="img/arjan-logo.png" class="img-fluid">

this will be replaced by:

<picture>
  <source type="image/webp" srcset="img/arjan-logo.png">
  <source type="image/png" srcset="img/arjan-logo.png">
  <img src="img/arjan-logo.png" class="img-fluid">
</picture>
  

CLI command

arjan optimize SITENAME [FILENAME] --img --webp --responsive --html --css --rcss --js

USAGE
  $ arjan optimize [FILENAME]

ARGUMENTS
  FILENAME  name of the file i.e. index.html

OPTIONS
  -c, --css     minifiy css using cssnano
  -h, --html    compress html using html-minifier
  -i, --images  compress images and if possible maintain the format, otherwise its converted to png.
  -j, --js      minify js using uglify js

  -w, --webp    saves a webp version of each image, then replaces each image instance in the html files with a picture tag.
  

Programmatic usage

For more info read the docs