Bund-Cake

0.0.31 · abandoned · verified Tue Apr 21

Bund-Cake is an early-stage JavaScript bundler and minifier specifically designed for integration with Express.js applications. It operates by taking multiple JavaScript source files and concatenating/minifying them into a single output file, which it then serves from a `/assets/bundle/` endpoint. The package, currently at version `0.0.31`, appears to be unmaintained or abandoned, with its public GitHub repository no longer accessible. This suggests no ongoing development, bug fixes, or security updates, and therefore no defined release cadence. Its primary differentiator was its direct integration within the Express application lifecycle, providing on-the-fly bundling capabilities rather than relying on a separate build step, making it suited for older, simpler Express projects that leverage server-side rendering with templating engines like EJS. Its usage of the `GLOBAL` object is indicative of older Node.js patterns.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to integrate `bund-cake` into a minimal Express.js application using EJS templates, bundling two sample JavaScript files and injecting them into the HTML output.

const express = require('express');
const path = require('path');
const app = express();
const port = 3000;

// IMPORTANT: Bund-Cake uses GLOBAL.bund by default.
// This is an outdated and generally discouraged practice.
// In a real application, consider a wrapper or alternative.
GLOBAL.bund = require('bund-cake')(app);

// Set up EJS as the view engine
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

// Serve static files (where your original JS files live)
app.use(express.static(path.join(__dirname, 'public')));

// Create dummy JS files for bundling
const fs = require('fs');
const publicDir = path.join(__dirname, 'public', 'javascripts');
if (!fs.existsSync(publicDir)) fs.mkdirSync(publicDir, { recursive: true });
fs.writeFileSync(path.join(publicDir, 'annoying-popups.js'), 'console.log("Annoying popup script loaded!"); alert("Hello from annoying popups!");');
fs.writeFileSync(path.join(publicDir, 'one-weird-tip.js'), 'console.log("One weird tip script loaded!"); document.getElementById("tip").innerText = "Drink more water!";');

// A simple route that renders a view with bundled JS
app.get('/', (req, res) => {
  res.render('index');
});

app.listen(port, () => {
  console.log(`Server running at http://localhost:${port}`);
  console.log('Open your browser to http://localhost:3000 to see the bundled JS.');
});

/*
// views/index.ejs
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bund-Cake Example</title>
</head>
<body>
    <h1>Welcome to Bund-Cake Example</h1>
    <p>Bundled JavaScript will be injected below:</p>
    <div id="tip"></div>

    <%- bund.js('./public/javascripts/annoying-popups.js', './public/javascripts/one-weird-tip.js') %>
</body>
</html>
*/

view raw JSON →