# rucksack

> JavaScript and CSS bundler using Vite.

Latest version **7.1.1** (published 2026-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install rucksack
pnpm add rucksack
yarn add rucksack
bun add rucksack
```

## Health

**Score 55/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 7.1.1 |
| Published | 2026-04-09 |
| First published | 2012-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Bloggify |
| Maintainers | ionicabizau |
| Keywords | rucksack, javascript, css, bundler |

## Links

- npm: https://www.npmjs.com/package/rucksack
- Repository: https://github.com/Bloggify/rucksack
- Homepage: https://github.com/Bloggify/rucksack#readme
- Issues: https://github.com/Bloggify/rucksack/issues
- npm.io page: https://npm.io/package/rucksack

## Dependencies (4)

- [vite](https://npm.io/package/vite.md) ^8.0.1
- [terser](https://npm.io/package/terser.md) ^5.44.1
- [rucksack-lite](https://npm.io/package/rucksack-lite.md) ^6.0.0
- [vite-plugin-node-polyfills](https://npm.io/package/vite-plugin-node-polyfills.md) ^0.26.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 7.1.1 (latest) — 2026-04-09
- 7.1.0 — 2026-03-23
- 7.0.0 — 2026-01-07
- 6.1.1 — 2025-05-06
- 6.1.0 — 2024-03-25
- 6.0.1 — 2024-01-01
- 5.0.3 — 2024-01-01
- 6.0.0 — 2024-01-01
- 5.0.2 — 2023-02-15
- 5.0.1 — 2023-02-15
- 5.0.0 — 2023-02-15
- 4.5.0 — 2022-02-28
- 4.4.1 — 2022-02-28
- 4.4.0 — 2022-02-28
- 4.3.0 — 2020-09-13
- … 38 more at https://npm.io/package/rucksack/versions

## README

<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->








[![rucksack](http://i.imgur.com/hSPcrjC.png)](#)











# rucksack

 [![Version](https://img.shields.io/npm/v/rucksack.svg)](https://www.npmjs.com/package/rucksack) [![Downloads](https://img.shields.io/npm/dt/rucksack.svg)](https://www.npmjs.com/package/rucksack)







> JavaScript and CSS bundler using Vite.

















## :cloud: Installation

```sh
# Using npm
npm install --save rucksack

# Using yarn
yarn add rucksack
```













## :clipboard: Example



```js
import Rucksack from "rucksack"

const __dirname = new URL(".", import.meta.url).pathname;

// Create a new bundler
let bundler = new Rucksack({
    name: "my-app",
    bundle_dir: `${__dirname}/output`,
    bundle_url: "/static",
    input: `${__dirname}/js-and-css-with-assets/main.js`,
    production: true,
    watch: false,
    config: async (existingConfig) => {
        existingConfig.build.rollupOptions.output.format = "es"
        return existingConfig
    }
})

// Add remote url as resource
bundler.add("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js")

bundler.bundle();
// vite v7.3.1 building client environment for production...
// ✓ 3 modules transformed.
// example/output/bg.svg      1.82 kB │ gzip: 0.66 kB
// example/output/my-app.css  0.08 kB │ gzip: 0.09 kB
// example/output/my-app.js   0.12 kB │ gzip: 0.11 kB
// ✓ built in 158ms

console.log(bundler.html())
// <script src="/static/my-app.js"></script>
// <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
// <link rel="stylesheet" href="/static/my-app.css" />
```











## :memo: Documentation


### `Rucksack(options)`
Creates a new instance of `Rucksack`.

#### Params

- **Object** `options`: The options object:
  - `name` (String): The bundle name.
  - `bundle_dir` (String): The bundle directory.
  - `bundle_url` (String): The bundle URL.
  - `input` (String): The input file.
  - `aliases` (Object): A map of aliases for module resolution.
  - `production` (Boolean): Whether to bundle for production.
  - `watch` (Boolean): Whether to watch files for changes.
  - `config` (Function): An async function to modify the Vite config.

#### Return
- **Object** The Rucksack instance containing:
  - `options` (Object): The options object.
  - `bundle_paths` (Object): The bundle paths:
    - `js` (String): The JS bundle path.
    - `css` (String): The CSS bundle path.
  - `bundle_urls` (Object): The bundle URLs:
    - `js` (String): The JS bundle URL.
    - `css` (String): The CSS bundle URL.
  - `local` (Object): The local resources collection.
    - `js` (Array): The JS resources.
    - `css` (Array): The CSS resources.
  - `remote` (Object): The remote resources collection.
    - `js` (Array): The JS resources.
    - `css` (Array): The CSS resources.
  - `markup` (Object): The cached HTML markup:
    - `js` (String): The JS HTML markup.
    - `css` (String): The CSS HTML markup.
    - `all` (String): The combined HTML markup.

### `bundleJS()`
Bundles JavaScript files using Vite.

#### Return
- **Promise** A promise that resolves when the JavaScript bundling is complete.









## :question: Get Help

There are few ways to get help:



 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
 2. For bug reports and feature requests, open issues. :bug:














## :yum: How to contribute
Have an idea? Found a bug? See [how to contribute][contributing].
























## :scroll: License

[MIT][license] © [Bloggify][website]






[license]: /LICENSE
[website]: https://bloggify.org
[contributing]: /CONTRIBUTING.md
[docs]: /DOCUMENTATION.md

---
_Source: https://npm.io/package/rucksack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
