{"id":15448,"library":"less-bundle-promise","title":"Less Bundle Promise","description":"Less Bundle Promise (less-bundle-promise) is a JavaScript utility designed to bundle multiple LESS files into a single output file. Primarily targeting larger projects with modular LESS structures, it offered a promise-based API for asynchronous compilation when it was actively maintained. The package, currently at version `1.0.11`, was last published approximately 4 years ago (as of 2026), indicating it is no longer actively developed or maintained. Its key differentiator at the time was the use of Promises for managing asynchronous Less compilation, which was a modern pattern for Node.js workflows. However, due to its abandonment, it lacks updates for newer Less features, Node.js versions, or modern module systems like ESM, making it largely unsuitable for contemporary projects.","status":"abandoned","version":"1.0.11","language":"javascript","source_language":"en","source_url":"git://github.com/mzohaibqc/less-bundle-promise","tags":["javascript","less","less-bundle","less-bundle-promise","bunlde-less"],"install":[{"cmd":"npm install less-bundle-promise","lang":"bash","label":"npm"},{"cmd":"yarn add less-bundle-promise","lang":"bash","label":"yarn"},{"cmd":"pnpm add less-bundle-promise","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package exclusively uses CommonJS `require()` syntax. It does not support ES Modules (ESM) `import` syntax. Attempting to import it as an ESM module will result in a runtime error.","wrong":"import bundle from 'less-bundle-promise';\n// or\nimport { bundle } from 'less-bundle-promise';","symbol":"bundle","correct":"const bundle = require('less-bundle-promise');"}],"quickstart":{"code":"const bundle = require('less-bundle-promise');\nconst fs = require('fs');\nconst path = require('path');\n\n// Create a dummy main.less file for demonstration\nconst mainLessContent = `\n@import \"./components/button.less\";\n@import \"./theme/colors.less\";\n\nbody {\n  font-family: Arial, sans-serif;\n  .button-style;\n  background-color: @primary-color;\n}\n`;\nconst buttonLessContent = `\n.button-style {\n  padding: 10px 15px;\n  border: 1px solid black;\n  border-radius: 5px;\n  color: white;\n}\n`;\nconst colorsLessContent = `\n@primary-color: #3498db;\n@secondary-color: #2ecc71;\n`;\n\nconst tempDir = path.join(__dirname, 'temp_less_project');\nconst componentsDir = path.join(tempDir, 'components');\nconst themeDir = path.join(tempDir, 'theme');\n\nfs.mkdirSync(componentsDir, { recursive: true });\nfs.mkdirSync(themeDir, { recursive: true });\nfs.writeFileSync(path.join(tempDir, 'main.less'), mainLessContent);\nfs.writeFileSync(path.join(componentsDir, 'button.less'), buttonLessContent);\nfs.writeFileSync(path.join(themeDir, 'colors.less'), colorsLessContent);\n\n// Bundle Less files and print to console\nbundle({\n    src: path.join(tempDir, 'main.less')\n}).then(output => {\n  console.log('--- Bundled LESS Output (to console) ---');\n  console.log(output);\n  console.log('----------------------------------------');\n})\n.catch(error => {\n  console.error('Error bundling LESS:', error);\n});\n\n// Bundle Less files and write to a destination file\nconst destPath = path.join(tempDir, 'bundle.less');\nbundle({\n    src: path.join(tempDir, 'main.less'),\n    dest: destPath,\n    writeFile: true\n}).then(output => {\n  console.log(`Bundle successfully written to ${destPath}`);\n  console.log('--- Content of bundle.less ---');\n  console.log(fs.readFileSync(destPath, 'utf8'));\n  console.log('------------------------------');\n})\n.catch(error => {\n  console.error('Error writing bundled LESS to file:', error);\n});\n\n// Clean up temporary files (optional, for a real quickstart you might omit cleanup for user inspection)\n// setTimeout(() => {\n//   fs.rmSync(tempDir, { recursive: true, force: true });\n//   console.log('Cleaned up temporary directory.');\n// }, 2000);","lang":"javascript","description":"This quickstart demonstrates how to use `less-bundle-promise` to compile multiple Less files into a single output, either printed to the console or written to a specified destination file. It showcases both the basic usage and the `writeFile` option, including creation of a temporary file structure for a runnable example."},"warnings":[{"fix":"For new projects, consider modern Less build tools like Webpack with Less-loader, Rollup with appropriate plugins, or the official `less` package directly with its newer API which includes promise support.","message":"This package is no longer maintained. It relies on older versions of Node.js (>=0.10.0) and the `less` compiler, which may not be compatible with modern Node.js runtimes (e.g., Node.js 16+ or 18+ which often mandates ESM) or the latest Less syntax and features.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your project uses CommonJS modules or transpile your code to CommonJS if integrating this package into an ESM environment. Alternatively, find a modern alternative that supports ESM.","message":"The package uses CommonJS `require` syntax exclusively and does not support ES Modules (ESM). Using `import` statements directly with this package in an ESM context will lead to runtime errors (e.g., `require is not defined` or module not found).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with your specific Less files. If issues arise, manually compile problematic sections with a modern Less compiler to identify incompatibilities or migrate to a more current bundling solution.","message":"Given its age, `less-bundle-promise` might not support newer Less language features, `@import` syntax variations, or CSS specifications that have been introduced in recent years. This could lead to unexpected compilation errors or incorrect output for modern Less stylesheets.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Verify the actual runtime dependencies in your `node_modules`. Be aware that the `less` version it compiles against will be fixed to whatever was bundled or used during its development, potentially outdated. Explicitly installing `less` as a direct dependency in a compatible older version might be necessary if this tool relied on a peer dependency.","message":"The package lists '0 Dependencies' on npm, which is highly unlikely for a Less bundler. This suggests that the `less` compiler itself might be a transitive dependency or assumed to be globally available, or it bundles an older version internally. This lack of explicit dependency management is problematic for modern package ecosystems.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Change your import statement to `const lessBundle = require('less-bundle-promise');` to use its CommonJS interface. If your project is strictly ESM, you might need to use a wrapper or reconsider this package.","cause":"Attempting to `import lessBundle from 'less-bundle-promise'` in a modern Node.js environment configured for ES Modules. This package is CommonJS-only.","error":"ReferenceError: require is not defined"},{"fix":"Simplify your Less code to older syntax, or, preferably, migrate to a current Less compilation pipeline that supports up-to-date Less and CSS standards.","cause":"Using modern Less syntax or features (e.g., advanced functions, new `@import` rules, or CSS features) that are not supported by the outdated Less compiler version likely used by `less-bundle-promise`.","error":"Error: Unrecognised input or other Less compilation errors."},{"fix":"Ensure a compatible Node.js version is used. Check Less input files for syntax errors that might prevent successful compilation and subsequent Promise resolution. Consult the internal `less` package for any specific polyfill requirements if running in highly constrained environments.","cause":"While `less-bundle-promise` uses Promises, an extremely old Node.js version (pre-ES6) or environment without a Promise polyfill might cause issues. However, given Node.js >=0.10.0 requirement, this is less likely to be the root cause than other factors like incorrect usage or deep incompatibility. A more probable cause is the underlying `less` compilation failing synchronously before a promise can be returned.","error":"TypeError: Cannot read properties of undefined (reading 'then') or similar Promise-related errors."}],"ecosystem":"npm"}