GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Bloggify/rucksack: 🎒 JavaScript and CSS bundler.

BranchesTags
Open more actions menu

Latest commit

 

History

185 Commits
185 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
example
example
 
 
lib
lib
 
 
.gitignore
.gitignore
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
DOCUMENTATION.md
DOCUMENTATION.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

rucksack

rucksack

Version Downloads

JavaScript and CSS bundler using Vite.

☁️ Installation

# Using npm
npm install --save rucksack

# Using yarn
yarn add rucksack

📋 Example

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" />

📝 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.

❓ Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. 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. 🐛

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

📜 License

MIT © Bloggify

About

🎒 JavaScript and CSS bundler.

Topics

hacktoberfest

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

3 stars

Watchers

3 watching

Forks

0 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.