1.0.0 • Published 7 months ago

ap-assets-extractor v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

ap-assets-extractor

A Node.js utility to extract asset paths (like images, stylesheets, and scripts) from HTML files. This tool is particularly useful for Progressive Web Apps (PWA), allowing you to identify assets that need to be cached in your Service Worker.

Features

  • Extracts asset paths from HTML files.
  • Supports images, CSS files, JavaScript files, and more.
  • Automatically normalizes asset paths to begin with a / (ideal for PWA caching).
  • Removes duplicate assets.
  • Easily configurable with a base directory and custom HTML file list.

Installation

npm install ap-assets-extractor

Usage

const AssetExtractor = require("ap-assets-extractor");

const files = ["/index.html", "/about.html", "/blog/mongodb-cheatsheet.html"];
new AssetExtractor("build")
.runExtractor(files)
.then(console.log);
1.0.0

7 months ago