Sarcina is a fully-automatic, zero-configuration web project bundler designed to prepare vanilla, non-framework web projects for production. It offers a simpler, faster alternative to complex bundlers like Webpack, specifically targeting projects that do not require constant re-building during development. Instead, Sarcina is intended for a single run prior to deployment. The current stable version is 1.7.6. Sarcina processes markup files, identifies CSS and JavaScript assets, creates optimized bundles, and re-inserts links to these new bundles. During this process, it minifies HTML, minifies and autoprefixes CSS, and minifies and transpiles JavaScript. This results in a distribution folder with fewer, smaller, and less complex files, significantly improving browser load times and user experience. Its primary differentiator is its "works-out-of-the-box" philosophy, eliminating the need for extensive configuration often associated with other bundlers.
npm install sarcinaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates programmatic usage of Sarcina to bundle a simple vanilla web project. It creates a source directory with HTML, CSS, and JavaScript files, then invokes the 'sarcina' function with input and output paths to generate an optimized 'dist' folder. It requires Node.js (with ESM support for this specific example) and 'sarcina' installed.
For framework-based projects, consider using their recommended build tools (e.g., Webpack, Vite, Parcel, or framework-specific CLIs) which are optimized for their ecosystems and development workflows.
Integrate Sarcina as a final step in your CI/CD pipeline or run it manually before deploying. For local development, use a simple HTTP server or a lightweight dev server, avoiding constant re-bundling with Sarcina.
Evaluate if Sarcina's default optimizations meet your project's specific requirements. For projects demanding fine-grained control over every aspect of the build process, a configurable bundler like Webpack or Rollup might be more suitable, albeit with increased setup complexity.
Always pin to a specific major version (e.g., `^sarcina@1.x.x`) to prevent unexpected breaking changes. Consult the official GitHub repository for updated programmatic API documentation when upgrading major versions.
If installed locally, run with `npx sarcina <input-dir> <output-dir>`. If you wish to use it globally, install with `npm install -g sarcina` (though `npx` is generally preferred for local installations).
Verify the input directory path is correct and exists relative to where you're running Sarcina (either via CLI or programmatically). Ensure there are no typos and the directory structure matches expectations.
Double-check the package's actual programmatic export. If `require('sarcina')` returns an object, try accessing a property like `sarcina.run()` or `sarcina.bundle()`. If using ESM `import`, ensure it's a default export, or try `import * as sarcina from 'sarcina';` and then `sarcina.default()` or `sarcina.run()`.No dependency data recorded yet.