Simple File Bundler

1.0.7 · active · verified Wed Apr 22

Simple File Bundler is a command-line utility designed to merge multiple files into a single bundle, primarily focused on concatenating CSS or JavaScript files. It operates via a configuration file (`simple-file-bundle.config.js`) located at the project root, which exports an array of bundling instructions. Each instruction specifies an output endpoint, a list of input files, an optional path prefix, and an optional separator. The package is currently at version 1.0.7, indicating a stable but likely feature-complete state with an infrequent release cadence. Its key differentiator is its minimalist approach, requiring minimal setup for basic file concatenation, contrasting with more complex bundlers that offer advanced features like module resolution, tree-shaking, or minification.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates installation, configuration with `simple-file-bundle.config.js`, and execution of the bundler to concatenate CSS and JS files into specified endpoints.

npm i simple-file-bundler

// simple-file-bundle.config.js
module.exports = [
    {
        prefix: __dirname,
        endpoint: 'dist/style.bundle.css',
        files: [
            'src/style1.css',
            'src/style2.css',
            'src/style3.css'
        ]
    },
    {
        prefix: __dirname,
        endpoint: 'dist/scripts.js',
        files: [
            'src/index.js',
            'src/superScript.js'
        ],
        separator: '\n'
    }
];

// Create some dummy files for demonstration
// src/style1.css
// body { color: red; }
// src/style2.css
// h1 { font-size: 2em; }
// src/index.js
// console.log('Hello from index.js');
// src/superScript.js
// console.log('Hello from superScript.js');

mkdir -p src dist
echo "body { color: red; }" > src/style1.css
echo "h1 { font-size: 2em; }" > src/style2.css
echo "console.log('Hello from index.js');" > src/index.js
echo "console.log('Hello from superScript.js');" > src/superScript.js

npx create-bundles

// Check outputs:
// cat dist/style.bundle.css
// cat dist/scripts.js

view raw JSON →