Registry / web-framework / gulp-build

gulp-build

JSON →
library0.5.3jsnpmunverified

The package `gulp-build` (version 0.5.3) is a Gulp 3 plugin designed to process files by swapping in variables using Handlebars templates. It facilitates building files for different environments by dynamically injecting data like Google Analytics IDs or compiling static HTML. Key features include support for Handlebars helpers, partials, and layouts, which were introduced in version 0.5.0, replacing earlier Underscore template integration. The plugin's current version (0.5.3) dates back to 2014 based on the copyright notice in its README, suggesting a lack of recent development. Its release cadence is effectively halted. It differentiates itself by providing a simple Handlebars-based templating pipeline within a Gulp 3 workflow, though a noted limitation is that partials and layouts must be provided as raw strings rather than file globs. Given its age and the fact that Gulp itself has advanced significantly beyond version 3, this package is effectively abandoned and may not be compatible with modern Gulp setups.

npm install gulp-build
INSTALL
IMPORT
SIG · GULP-BUILD
G
gulp-build
web-frameworkjavascriptv0.5.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

build
const build = require('gulp-build');
import build from 'gulp-build';
This package is a CommonJS module and does not support ES modules directly. It is designed for Gulp 3, which often used CommonJS.

Demonstrates basic usage of `gulp-build` to process HTML files using Handlebars with dynamic data, partials, and a layout.

const gulp = require('gulp'); const build = require('gulp-build'); const path = require('path'); // Pre-requisites: // 1. Create a 'src' directory in your project root. // 2. Inside 'src', create 'index.html' with content like: <h1>Hello, {{title}}!</h1>\n{{> footer}} // 3. Run `npm install --save-dev gulp gulp-build` const buildOptions = { partials: [{ name: 'footer', tpl: '<p>Copyright 2013 by My Company</p>' }], layout: '<html><head><title>{{title}}</title></head><body>\n{{> body}}\n</body></html>' }; gulp.task('build-html', function() { // Processes HTML files from the 'src' directory // and outputs them to a 'dist' directory. return gulp.src(path.join(__dirname, 'src', '*.html')) .pipe(build({ title: 'My Awesome Website' }, buildOptions)) .pipe(gulp.dest(path.join(__dirname, 'dist'))); }); // To run this task, execute `gulp build-html` in your terminal.
Debug
Known issues
breakingVersion 0.5.0 introduced a significant breaking change by migrating the templating engine from Underscore templates to Handlebars. Projects upgrading from versions prior to 0.5.0 will need to rewrite their templates to conform to Handlebars syntax.
fix
Rewrite all existing Underscore templates to Handlebars syntax. Consult Handlebars documentation for syntax and helper migration.
affects: >=0.5.0
gotchaWhen using layouts, the `{{> body}}` Handlebars partial is mandatory within your layout string. Omitting this tag will result in the main content of your source files not being injected into the layout, leading to empty or incomplete output files.
fix
Ensure your `config.layout` string explicitly includes `{{> body}}` where you want the main content to be inserted.
affects: >=0.5.0
gotchaThe `partials` and `layout` options only accept strings for their template definitions. There is no built-in support for globbing file paths for partials or layouts, meaning all template content must be provided inline or read into strings programmatically.
fix
Manually read partial and layout files into strings before passing them to the `gulp-build` options. For example, use `fs.readFileSync` to load templates.
affects: >=0.5.0
deprecatedThis package is designed for Gulp 3 and has not been updated since 2014 (version 0.5.3). It is effectively abandoned and may not be compatible with newer versions of Node.js or Gulp (Gulp 4+). Consider using more modern templating solutions or Gulp plugins.
fix
Evaluate alternative, actively maintained templating plugins for Gulp or migrate to a different build system if Gulp 3 compatibility is not critical.
affects: >=0.5.3
Errors
Common errors & fixes
Compiled file is missing the main content or appears empty.
The layout string passed to `gulp-build` does not contain the mandatory `{{> body}}` tag.
fix
Edit your `config.layout` string to include `{{> body}}` at the position where the main file content should be rendered.
TypeError: Cannot read properties of undefined (reading 'registerHelper') or similar Handlebars errors.
Attempting to use `gulp-build` with templates written in Underscore.js syntax after upgrading to version 0.5.0 or later, which switched to Handlebars.
fix
Rewrite your templates from Underscore.js syntax to Handlebars syntax. Ensure all helpers, partials, and data references conform to Handlebars specifications.
Upgrade
Version history
0.5.3latest on npm
Audit
Dependencies
gulprequiredPeer dependency, as this is a Gulp plugin. Specifically designed for Gulp 3.
handlebarsrequiredInternal templating engine used for processing files.
Agent activity
4 hits · last 30 days
node
4
Resources