Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/divriots/jampack

Optimizes static websites for best user experience and best Core Web Vitals scores.
https://github.com/divriots/jampack

blog jamstack node static-site static-site-building static-site-generator

Last synced: 4 days ago
JSON representation

Optimizes static websites for best user experience and best Core Web Vitals scores.

Awesome Lists containing this project

README

        

```
__ __
|__|____ _____ ___________ ____ | | __
| \__ \ / \\____ \__ \ _/ ___\| |/ /
| |/ __ \| Y Y \ |_> > __ \\ \___| <
/\__| (____ /__|_| / __(____ /\___ >__|_ \
\______| \/ \/| | \/ \/ \/
|__|
```

[![npm version](https://img.shields.io/npm/v/@divriots/jampack)](https://npmjs.org/package/@divriots/jampack)
[![Discord](https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord)](https://discord.gg/XkQxSU9)

# Jampack

Optimizes static websites for best user experience and best Core Web Vitals scores.


Brought to you by


‹div›RIOTS


‹div›RIOTS

## What is `jampack`?

> Not a bundler. Not a framework.

`jampack` is a post-processing tool that takes the output of your [Static Site Generator (aka SSG)](https://jamstack.org/generators/) and optimizes it for best user experience and best [Core Web Vitals](https://web.dev/learn-core-web-vitals/) scores.

[Read the introduction blog post](https://divriots.com/blog/introducing-jampack/)

## What can `jampack` do?

### ``

```html
Red panda
```

becomes responsive with dimensions:

```html
Red panda
```

### ``

```html

Red panda

```

becomes responsive with multiple formats including AVIF:

```html



Red panda

```

[Read more](/features/optimize-images)

### CDN images become responsive

```html
Clouds in the sky by Taylor Van Riper
```

becomes

```html
Clouds in the sky by Taylor Van Riper
```

[Read more](/features/optimize-images-cdn)

### External images can be downloaded and optimized

```html
Clouds in the sky by Taylor Van Riper
```

becomes

```html
Clouds in the sky by Taylor Van Riper
```

[Read more](/features/optimize-images-external)

### Above & below-the-fold

`jampack` optimizes assets above-the-fold ⬆️.

- Images are loaded with higher priority.
- Small images are embedded in HTML.

Lazy-load assets below-the-fold ⬇️.

- Images and Iframes are lazy loaded.

[Read more](https://jampack.divriots.com/features/optimize-above-the-fold/)

## Inline critical CSS

Avoid [FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content) while stylesheets are downloaded and parsed.
`jampack` will inline critical CSS and lazy-load the rest of CSS.

[Read more](https://jampack.divriots.com/features/inline-critical-css/)

## Prefetch links

Speedup the future page navigations by prefetching the links on the page.
Thanks to [quicklink](https://github.com/GoogleChromeLabs/quicklink), this can be done dynamically as links enter the viewport.

[Read more](https://jampack.divriots.com/features/prefetch-links/)

### All assets are compressed

In a 2nd PASS, `jampack` compresses all untouched assets and keep the same name and the same format.

| Extension | Compressor |
| --------------- | --------------------- |
| `.html`,`.htm` | [`html-minifier-terser`](https://github.com/terser/html-minifier-terser) |
| `.css` | [`lightningCSS`](https://lightningcss.dev) |
| `.js` | [`esbuild`](https://esbuild.github.io/) or [`swc`](https://swc.rs/) |
| `.svg` | [`svgo`](https://github.com/svg/svgo) |
| `.jpg`,`.jpeg` | [`sharp`](https://sharp.pixelplumbing.com/) |
| `.png` | [`sharp`](https://sharp.pixelplumbing.com/) |
| `.webp` | [`sharp`](https://sharp.pixelplumbing.com/) |
| `.avif` | [`sharp`](https://sharp.pixelplumbing.com/) |

### [And a lot more!](https://jampack.divriots.com/)

## Quick use

```sh
# Optimize static website in `dist` folder
npx @divriots/jampack ./dist
```

For more options see [CLI options](https://jampack.divriots.com/cli-options/).

## `jampack` used in the wild

- Powering all [‹div›RIOTS](https://divRIOTS.com)' websites
- [keycloak.ch](https://keycloak.ch)
- [bayjs.org](https://bayjs.org/)
- [qwind.pages.dev](https://qwind.pages.dev/)
- [Bloycey's Blog](https://bloycey.blog/)
- [gxanshu.in](https://gxanshu.in/)
- [cloudcannon.com](https://cloudcannon.com)
- [groupsync.app](https://groupsync.app)
> Add yours here

## Why is it called `jampack`?

- `jam`: From [Jamstack](https://en.wikipedia.org/wiki/Jamstack).
- `pack`: Reminescent of the [Executable Packers](https://en.wikipedia.org/wiki/Executable_compression#List_of_executable_packers) from the 90s.

## License

This software is released under the terms of the [MIT license](https://github.com/divriots/jampack/blob/main/LICENSE).