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

svelte-bundle

v0.0.24

Published

CLI tool to easily bundle a .svelte file into a single .html file

Downloads

447

Readme

⚠️ NOTICE: While this tool is currently functional, it has not nearly been battle-tested enough to ensure it works in most use-cases.

Usage

This tool can be used with npx:

npx svelte-bundle -i <input-dir> -o <output-dir>

Full Documentation: https://github.com/uhteddy/svelte-bundle/wiki

Svelte Bundle CLI

Svelte Bundle CLI is a simple command-line tool that allows you to bundle a Svelte application into a single .html file using Vite and SSR (Server-Side Rendering). The goal of this tool is to make it easy to bundle Svelte apps for deployment, particularly for cases where everything needs to be contained in a single file.

Just note, the purpose of this tool is NOT to bundle an entire Svelte app, in-fact it is highly discouraged due to the overhead of the generated file. The purpose of this is to expand the capabilities of svelte to work on systems like certain Content Management Systems (CMS) that only allow HTML, CSS, and JS. It also was created with SSR so that the generated file is SEO-safe where necessary elements are already hydrated.

Utilizing this you will be able to develop a page with the joy of svelte and be able to directly get a single .html file that you can utilize getting full use-case of svelte.

⚠️ Note: This tool is NOT made to function with SvelteKit natively, this takes a single .svelte file as input and will output a single .html file.

Inspiration

This tool was inspired by the need I had when it came to updating the CMS for a company I worked for. They were looking for more custom content on their website which used an outdated CMS. Pages were only able to include HTML, CSS, and JS.

Pure HTML, CSS, and JS can be grainular and more-importantly, lacks the reactivity that Svelte has. Meaning, to develop certain features I had to focus a lot more on the "what to do" when data changes, rather than Svelte handling that for me.

So, I searched for tools around that could be of assistance. I found figsvelte which was of so much help in the underlying understanding of what to do. But, it did not accomplish all I was looking for. I needed a solution that didn't just generate an HTML file with JS that hydrated the page. Through a lot of tinkering around I was able to finally get the system to work.

I noticed through a lot of google searches I wasn't the only one looking for a solution like this, yet, I was unable to find one that addressed everything I was looking for. So, for this reason I have decided to build svelte-bundle to take care of this in a much more simplistic and CLI way.

Features

  • [x] Bundles Svelte applications
  • [x] Outputs a single .html file ready for deployment.
  • [x] CLI arguments for specifying input and output directories.
  • [x] Tests and CI integration.
  • [x] Handle CSS and assets within the bundled file.
  • [x] Add tailwindcss support, this is in beta.
  • [x] Implement error handling and more robust validation.