
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
local-assets
Advanced tools
CLI tool to extract local\* stylesheets, images, scripts, fonts and other subresources (assets) from a HTML document, and optionally copy them into a directory.
CLI tool to extract local* stylesheets, images, scripts, fonts and other subresources (assets) from a HTML document, and optionally copy them into a directory.
*local here means resources under the same-origin and available in same directory as given HTML document.
While creating an auto-publish GitHub Action for W3C specifications (See spec-prod), I wanted to find the minimal files needed by the specification. This ensures we do not deploy the specification when unrelated files (like metadata files, CI scripts etc.) get changed. We want to deploy only the main HTML file (the specification) and its dependencies (generally CSS files and images) to GitHub pages and/or https://w3.org.
Now, this works outside the W3C use-case also, so I created this tool as a CLI if other people also find it useful.
This tool is meant to be used as a CLI, although you can also import it as a regular Node.js module.
You can install this tool as a CLI:
npm install --global local-assets
# Or, with yarn
yarn global add local-assets
Then, you can extract all local resources from index.html
and copy them to ../all-the-files/
directory as:
local-assets index.html -o ../all-the-files/
If you do not wish to copy the assets and just list them out (on stdout
):
local-assets index.html
For a more verbose output, set the VERBOSE
environment variable. This will log additional information on stderr
. The list of assets will be still be outputted to stdout
.
VERBOSE=1 local-assets index.html
If you already have a Chromium based browser (Google Chrome, Microsoft Edge) installed, you can avoid re-downloading it by setting the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
env variable before install. You would need to specify the location of your Chromium binary (PUPPETEER_EXECUTABLE_PATH
) during CLI usage though. So:
# Install
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
npm install --global local-assets
# Use
export PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome
# Or, export PUPPETEER_EXECUTABLE_PATH="$(which google-chrome)"
local-assets index.html
document.querySelectorAll
APIs to find all subresources, and process them (this is done using the subresource package).FAQs
CLI tool to extract local\* stylesheets, images, scripts, fonts and other subresources (assets) from a HTML document, and optionally copy them into a directory.
We found that local-assets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.