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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rollup-plugin-html-entry

v0.3.0

Published

Use HTML files as entry points in your rollup bundle

Downloads

55

Readme

Build Status

rollup-plugin-html-entry

Use HTML files as entry points in your rollup bundle. HTML files and HTML imports will be traversed, then all scripts found will be combined. Optionally, write HTML files cleaned of <script>s. This is particularly useful for web components and web applications in general.

<!-- 0.html -->
<script>export const zero = 0;</script>
<!-- 1.html -->
<script>export const one = 1;</script>
<!-- 2.html -->
<script src="2.js"></script>
// 2.js
export const two = 2;
<!-- all-imports.html -->
<link rel="import" href="0.html">
<link rel="import" href="1.html">
<link rel="import" href="2.html">

Using all-imports.html as entry point will yield a bundle with exports for zero, one, and two.

So, this plugin works like rollup-plugin-multi-entry does, but using <script>s contained in HTML files as entry points.

Install

$ npm install [--save-dev] rollup-plugin-html-entry

Usage

This plugin requires at least v0.48.0 of rollup. In rollup.config.js:

import htmlEntry from 'rollup-plugin-html-entry';

export default {
  input: 'test/**/*.html',
  plugins: [htmlEntry()]
};

The input above is the simplest form which simply takes a glob string. You may pass an array of glob strings or an object with one or more of the following options:

export default {
  input: {
    // Arrays of globs to include
    include: ['index.html', 'and/globs/**/*.html'],
    // Arrays of globs to exclude
    exclude: ['excluded-file.html', 'and/globs/*.to.be.excluded.html'],
    // Arrays of globs that should remain external to the bundle
    external: ['lazy-imports.html', 'and/globs/*.to.be.omitted.html']
  }
  // ...
};

By default HTML files will be not written. If output option is present, HTML files stripped of <script>s will be written into specified path.

export default {
  input: 'index.html',
  plugins: [htmlEntry({ output: "build" })]
  // ...
};

Finally, you may not need to export anything from the rolled-up bundle for web applications. In such cases, use the exports: false option like so:

export default {
  input: 'index.html',
  plugins: [htmlEntry({ exports: false })]
};

License

MIT