Skip to content

πŸŽ’ JavaScript and CSS bundler.

License

Notifications You must be signed in to change notification settings

Bloggify/rucksack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

166 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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
})

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

bundler.bundle();

console.log(bundler.html())

πŸ“ 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.

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

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •