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

deferify

v0.5.0

Published

Adds defer attributes to script tags

Downloads

2

Readme

DEFERIFY

Build Status GitHub codecov

Disclaimer

This is the optimization package. As any optimization, it should be take with care,with measuring results before and after applying.

Idea

If you have Single Page application, you, probably, don't' want to block loading your application with synchronous scripts. To help with this defer and async tags appeared. But what if you use cli for generating output? Right now, no @angular/cli, no react, doesn't support adding asynchronous attributes out of the box. This tiny CLI parse your index.html file and adds defer attribute to your scripts tag

Benefits

Just check lighthouse reports. Left side - before, right - after. All comparisons were done on default applications produced by the corresponding cli without any additional optimization/changes.

@angular/CLI

(v. 7.3.8)

Check these two image from the lighthouse. Nothing was done except deferify. Looks better, yeah? lighthouse comparsion for angular/cli

Lighthouse reports: before, after

create-react-app

(v. 16.8.6)

lighthouse comparsion for create-react-app

Lighthouse reports: before, after

All comparisons were done 21.04.2019 and may vary depending on your conditions.

What about VUE

Right now, adding defer attribute to the hello-world VUE application demonstrate a slightly negative impact or no impact. This shows that all performance tunings should be carefully measured before going to the prod.

How to use

Install deferify

npm i --save-dev deferify

Add it to your build process:

"build:prod" : "ng build --prod && deferify"

Deferify will scan your dist folder and all it's subfolders for all index.html files and tries to update them. Also you can pass path to another folder:

deferify build/

or just to the single file

deferify prod/index.html

Skipped tags

Deferify will not touch scripts without src, with already added defer or async attributes.

What about adding async attribute

The tool should do only one thing and do it well