Awesome Open Source
Awesome Open Source

Asset bundler for Deno apps

deno-buckets logo

deno doc GitHub License GitHub release (latest by date)

Buckets is a wrapper around the native Deno bundler, it allows to:

  • access readonly buckets with no js/ts files from your scripts
  • bundle those assets with the scripts into a single .js file to compile with Deno


This library exports 2 methods: loadBuckets and bundle. The first one exposes a tree with the contents of your folders and the second one bundles the app with all the assets. Both methods require the bundle options as unique parameter.


  • key string: this avoids stores clashing
  • optionsUrl string: import.meta.url
  • entry string: relative to config folder
  • output string: if you omit this, the bundle will be sent to stdout
  • buckets BucketOptions[]: a list of bucket configurations. See below


  • name string: for future reference
  • folder string: relative to config folder
  • maxDepth? number: by default, there's no limit
  • exts?: string[]: a list of extensions to filter in.
  • match?: RegExp[]: a list of regexes to filter in
  • skip?: RegExp[]: a list of regexes to filter out
  • trimExtensions? boolean: remove the extension from the file name. Requires option exts
  • decoder? fuction: it uses TextDecoder by default

Arguments marked with a question mark (?) are optional



export default {
  key: "my-key",
  optionsUrl: import.meta.url,
  entry: "app.ts",
  buckets: [
      name: "data",
      folder: "countries",
      name: "mustaches",
      folder: "assets/mustaches/templates",
      exts: [".template"],
      trimExtensions: true,
  output: "app.bundle.js",


import { loadBuckets } from "[email protected]/mod.ts";
import bucketsConf from "./buckets.ts";

const buckets = loadBuckets(bucketsConf);
// {
//   mustaches: {
//     "country-info": ".....",
//     "other-info": ".....",
//     ...
//   },
//   data: {
//     "capitals.txt": ".....",
//     "population.txt": ".....",
//     ...
//   }
// }


import conf from "./buckets.ts";
import { bundle } from "[email protected]/mod.ts";

await bundle(conf);

2021 Jacobo Tabernero Rey - Released under MIT License

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Typescript (251,877
File (2,161
Deno (1,451
Assets (716
Tree Structure (365
Bundler (285
Single File (143
Related Projects