Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
inline-source-cli executable
✓ import { spawn } from 'child_process';
spawn('inline-source', ['--root', './', 'file.html'], { stdio: 'inherit' });
✗ import { runCli } from 'inline-source-cli';
This package is a command-line interface (CLI) and does not export programmatic symbols. Its primary interaction is via the `inline-source` executable. Programmatic use involves spawning a child process.
Programmatic execution (using execa)
✓ import { execa } from 'execa';
await execa('inline-source', ['--root', './', 'file.html']);
✗ const inlineSourceCli = require('inline-source-cli/cli');
For robust programmatic execution from Node.js, external libraries like 'execa' are commonly used. Directly requiring internal CLI files is unsupported and highly unstable.
Type definitions
✓ /* This CLI package does not export types for programmatic use. */
✗ import type { InlineSourceOptions } from 'inline-source-cli';
As a pure CLI wrapper, this package does not provide TypeScript type definitions for its own use. Type definitions for the underlying inlining options would come from the `inline-source` library directly.
Demonstrates how to programmatically execute `inline-source-cli` from a Node.js script, creating dummy files, running the inliner, and capturing its output.
import { spawn } from 'child_process';
import path from 'path';
import fs from 'fs';
// Create a dummy HTML file and resources for demonstration
const buildDir = path.join(process.cwd(), 'build-cli-demo');
if (!fs.existsSync(buildDir)) fs.mkdirSync(buildDir, { recursive: true });
fs.writeFileSync(path.join(buildDir, 'style.css'), 'h1 { color: blue; }');
fs.writeFileSync(path.join(buildDir, 'script.js'), 'console.log(\'Script inlined!\');');
fs.writeFileSync(path.join(buildDir, 'index.html'), `<!DOCTYPE html>\n<html>\n<head>\n <link rel=\"stylesheet\" href=\"./style.css\">\n</head>\n<body>\n <h1>Hello, Inliner!</h1>\n <script src=\"./script.js\"></script>\n</body>\n</html>`);
console.log('Created dummy files in:', buildDir);
// Resolve the path to the inline-source CLI executable
const inlineSourceCliPath = path.resolve(process.cwd(), 'node_modules', '.bin', 'inline-source');
// Execute the inline-source CLI tool
const child = spawn(inlineSourceCliPath, [
'--compress', 'false',
'--root', buildDir,
path.join(buildDir, 'index.html')
], { stdio: 'pipe' });
let output = '';
child.stdout.on('data', (data) => {
output += data.toString();
});
child.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
child.on('close', (code) => {
if (code === 0) {
console.log('\n--- Inlined HTML Output ---');
console.log(output);
fs.writeFileSync(path.join(buildDir, 'bundle.html'), output);
console.log('\nOutput written to', path.join(buildDir, 'bundle.html'));
} else {
console.error(`CLI process exited with code ${code}`);
}
// Clean up dummy files
fs.unlinkSync(path.join(buildDir, 'index.html'));
fs.unlinkSync(path.join(buildDir, 'style.css'));
fs.unlinkSync(path.join(buildDir, 'script.js'));
fs.unlinkSync(path.join(buildDir, 'bundle.html'));
fs.rmdirSync(buildDir);
console.log('Cleaned up dummy files.');
});
inline-source --version
Errors
Common errors & fixes
Error: Command failed with exit code 1
A generic error indicating the CLI process encountered an unhandled error or failed validation.
fixCheck the `stderr` output from the CLI for more specific error messages, often related to file paths, invalid options, or issues with the input HTML structure.
Error: ENOENT: no such file or directory, stat 'path/to/your/file.html'
The specified input HTML file or a linked resource (CSS, JS, image) could not be found at the given path.
fixVerify that the input HTML file path is correct and that all referenced local assets exist relative to the `--root` directory or the HTML file's location.
Error: Unknown option '--some-new-option'
Attempting to use a CLI option that does not exist or is deprecated in the current `inline-source-cli` version.
fixConsult the `inline-source --help` output or the package documentation for available command-line options and their correct syntax.
Audit
Dependencies
inline-sourcerequiredThis CLI wraps the core functionality of the inline-source library.