Foso is a convention-over-configuration JavaScript bundler, designed to simplify resource bundling with minimal setup. Originally conceived as an alternative to highly configurable task runners like Gulp or Grunt, Foso's core philosophy centers on zero-configuration operations. It automatically bundles resources using specific `fosify-*` plugins, watches for file changes to trigger re-bundling, includes a LiveReload server for automatic browser refreshes, and can optionally serve bundled assets via a static server. The system leverages naming conventions (e.g., `bundle.js`, `[something].bundle.js`) to determine how files are processed and outputted. The current and likely final stable version is 0.10.3, with development having ceased approximately seven years ago, indicating it is no longer actively maintained. Its primary differentiators were its simplicity and opinionated conventions to reduce boilerplate configuration.
npm install fosoVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to set up and initiate a Foso bundling process programmatically, registering the `fosify-less` plugin. It creates temporary source and destination directories to illustrate the convention-based file handling.
Migrate to a modern, actively maintained bundler like Webpack, Rollup, Vite, or Parcel. These tools offer better performance, feature sets, and security.
If integrating into an ESM project, you must use `require()` within a CommonJS context or transpile your code, or use dynamic `import()` if Node.js runtime supports it and the module is compatible. It is generally safer to assume CommonJS-only usage.
If you must use `foso` CLI, perform `npm install -g foso` and `npm install -g fosify-js fosify-less fosify-html`. However, reconsidering the project's abandoned status and global dependency model is advisable.
Run `npm install foso` in your project directory for local usage, or `npm install -g foso` for global CLI usage.
Ensure your file is treated as a CommonJS module (e.g., using a `.js` extension without `type: "module"` in `package.json`), or use a compatibility layer if necessary. The recommended long-term solution is migrating to a modern bundler that supports ESM.
Install `foso` globally using `npm install -g foso`. Verify installation by running `foso --version` (if supported) or checking npm global binaries.