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

astro-internalise-css

v1.0.0

Published

Astro integration to internalise all external style sheets in HTML files.

Readme

astro-internalise-css

Astro integration to internalise all external style sheets in HTML files.

Before:

<html>
  <head>
    <link href="/foo.css" />
    <link href="/bar.css" />
  </head>
</html>
/* foo.css */
.foo {
  color: blue;
}
/* bar.css */
.bar {
  color: red;
}

After:

<html>
  <head>
    <style type="text/css">
      .foo {
        color: red;
      }
    </style>
    <style type="text/css">
      .bar {
        color: blue;
      }
    </style>
  </head>
</html>

And unreferenced external style sheets foo.css and bar.css removed!

Installation

Automatic integration setup:

npx astro add astro-internalise-css

Or manually:

npm install -D astro-internalise-css
// astro.config.mjs
import astroInternaliseCSS from "astro-internalise-css";

export default {
  integrations: [astroInternaliseCSS()],
};

Motivation

When a browser requests a website, the website is transferred to the client in packets. The size of these packet transfers will get incrementally larger (based on TCP slow start), but the first packet is 14KB.

Many websites are small enough to internalise external style sheets for each HTML file and still be under 14KB, thus the website can be delivered to the client in the first packet transfer. This is faster than delivering the HTML and external style sheets in separate packets where delays are incurred from extra fetches. Even if the website is not under 14KB, internalising CSS will usually be more performant for smaller sites.

Note: one such benefit of using external style sheets is the browser can cache individual CSS files, and so if the website is large and changes over time are made to select CSS files, then it may make sense to avoid this integration to take advantage of browser caching.

Contributing

Please report any issues or feature requests on GitHub. Contributions are welcome!

I appreciate the current implementation is quite simple and naive but it gets the job done (for now).

Acknowledgements

Inspired by astro-single-file.

Astro is working on integrating CSS inlining natively. When this is available, this integration may be redundant.