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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vicatia-bundler

v2.0.0-pre.10

Published

Process Web Components into one output file

Readme

vicatia-bundler

Reduce an HTML file and its dependent HTML Imports into one file

Web pages that use multiple HTML Imports to load dependencies may end up making lots of network round-trips. In many cases, this can lead to long initial load times and unnecessary bandwidth usage. The vicatia-bundler tool follows HTML Imports and <script> tags to inline these external assets into a single page, to be used in production.

In the future, technologies such as HTTP/2 and Server Push will likely obsolete the need for a tool like vicatia-bundler for production uses.

Installation

vicatia-bundler is available on npm. For maximium utility, vicatia-bundler should be installed globally.

npm install -g vicatia-bundler

This will install vicatia-bundler to /usr/local/bin/vicatia-bundler (you may need sudo for this step).

Options

  • -h|--help: print this message
  • -v|--version: print version number
  • --exclude <path>: exclude a subpath from root. Use multiple times to exclude multiple paths. Tags (imports/scripts/etc) that reference an excluded path are left in-place, meaning the resources are not inlined. ex: --exclude=elements/x-foo.html --exclude=elements/x-bar.html
  • --inline-scripts: Inline external scripts.
  • --inline-css: Inline external stylesheets.
  • --redirect <uri>|<path>: Takes an argument in the form of URI|PATH where url is a URI composed of a protocol, hostname, and path and PATH is a local filesystem path to replace the matched URI part with. Multiple redirects may be specified; the earliest ones have the highest priority.
  • --strip-comments: Strips all HTML comments not containing an @license from the document.
  • --sourcemaps: Honor (or create) sourcemaps for inline script tags.
  • --out-html <path>: If specified, output will be written to instead of stdout.
  • --out-dir <path>: If specified, output will be written to . Necessary if bundling multiple files.

Usage

The command

vicatia-bundler target.html

will inline the HTML Imports of target.html and print the resulting HTML to standard output.

The command

vicatia-bundler target.html > build.html

will inline the HTML Imports of target.html and print the result to build.html.

The command

vicatia-bundler -p "path/to/target/" /target.html

will inline the HTML Imports of target.html, treat path/to/target/ as the webroot of target.html, and make all urls absolute to the provided webroot.

The command

vicatia-bundler --exclude "path/to/target/subpath/" --exclude "path/to/target/subpath2/" target.html

will inline the HTML Imports of target.html that are not in the directory path/to/target/subpath nor path/to/target/subpath2.

If the --strip-exclude flag is used, the HTML Import <link> tags that point to resources in path/to/target/subpath and path/to/target/subpath2/ will also be removed.

The command

vicatia-bundler --inline-scripts target.html

will inline scripts in target.html as well as HTML Imports. Exclude flags will apply to both Imports and Scripts.

The command

vicatia-bundler --inline-css target.html

will inline Polymerized stylesheets, <link rel="import" type="css">

The command

vicatia-bundler --strip-comments target.html

will remove HTML comments, except for those that begin with @license. License comments will be deduplicated.

Using vicatia-bundler programmatically

vicatia-bundler as a library has two exported function.

vicatia-bundler constructor takes an object of options similar to the command line options.

  • excludes: An array of strings with regular expressions to exclude paths from being inlined.
  • stripExcludes: Similar to excludes, but strips the imports from the output entirely.
    • If stripExcludes is empty, it will be set the value of excludes by default.
  • inlineScripts: Inline external scripts.
  • inlineCss: Inline external stylesheets.
  • addedImports: Additional HTML imports to inline, added to the end of the target file
  • redirects: An array of strings with the format URI|PATH where url is a URI composed of a protocol, hostname, and path and PATH is a local filesystem path to replace the matched URI part with. Multiple redirects may be specified; the earliest ones have the highest priority.
  • sourcemaps: Honor (or create) sourcemaps for inline scripts
  • stripComments: Remove non-license HTML comments.
  • loader: A hydrolysis loader. This loader is generated with the target argument to vulcan.process and the exclude paths. A custom loader can be given if more advanced setups are necesssary.

vicatia-bundler.process takes a target path to target.html and a callback.

Example:

var Bundler = require('vicatia-bundler');
var Analyzer = require('vicatia-analyzer');


var bundler = new Bundler({
  excludes: [
    '\\.css$'
  ],
  stripExcludes: [
  ],
  inlineScripts: false,
  inlineCss: false,
  addedImports: [
  ],
  redirects: [
  ],
  implicitStrip: true,
  stripComments: true
});

bundler.bundle([target]).then((bundles) => {
    /**
      * do stuff here
      */
})

Caveats

Because HTML Imports changes the order of execution scripts can have, vicatia-bundler has to make a few compromises to achieve that same script execution order.

  1. Contents of all HTML Import documents will be moved to <body>

  2. Any scripts or styles, inline or linked, which occur after a <link rel="import"> node in <head> will be moved to <body> after the contents of the HTML Import.