Gulp Bundler with JSON Configuration

1.0.0-alpha.23 · abandoned · verified Tue Apr 21

gulpfile-config is a Gulp utility designed to simplify web asset bundling and compilation tasks through a declarative `gulpfile-config.json` file. It abstracts common Gulp tasks, enabling configuration-driven builds for various asset types including HTML, MJML templates, SASS/CSS, and JavaScript, with built-in options for minification. The package also includes basic development server capabilities. It is currently in an early alpha state (version `1.0.0-alpha.23`) and has not seen active development since December 2021, suggesting it is effectively abandoned. Its primary differentiation lies in minimizing boilerplate in `gulpfile.js` by centralizing build logic in a JSON file, intended for use with Gulp CLI version 4.0.0 and older Node.js runtimes (Node 12-17).

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to set up a project using `gulpfile-config` to compile HTML, SCSS, and JavaScript, then serve the compiled assets with a development server using `gulp` commands.

// 1. Ensure Gulp CLI is installed globally: npm install gulp-cli -g

// 2. Initialize a new project and install dependencies
//    mkdir my-project && cd my-project
//    npm init -y
//    npm install --save-dev gulp@^4.0.0 gulpfile-config@^1.0.0-alpha.23

// 3. Create 'gulpfile.js' in your project root:
//    const gulp = require('gulp');
//    require('gulpfile-config'); // This line registers all tasks defined in gulpfile-config.json

// 4. Create 'gulpfile-config.json' in your project root:
/*
{
  "targets": {
    "browser": {
      "compile": [
        { "input": "src/**/*.html", "output": "dist/", "minify": true },
        { "input": "src/css/main.scss", "output": "dist/css/main.css", "minify": true },
        { "input": "src/js/main.js", "output": "dist/js/main.js", "minify": true }
      ]
    }
  },
  "server": { "root": "./dist", "port": 3000 }
}
*/

// 5. Create example source files in a 'src' directory:
//    src/index.html:
/*
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Gulp Config Example</title><link rel="stylesheet" href="css/main.css"></head><body><h1>Hello, Gulpfile Config!</h1><script src="js/main.js"></script></body></html>
*/

//    src/css/main.scss:
/*
$primary-color: #3498db; body { font-family: Arial, sans-serif; color: $primary-color; h1 { text-align: center; } }
*/

//    src/js/main.js:
/*
document.addEventListener('DOMContentLoaded', () => { console.log('JavaScript loaded and DOM is ready!'); const heading = document.querySelector('h1'); if (heading) { heading.textContent += ' (from JS)'; } });
*/

// 6. Run Gulp tasks from your terminal in the project root:
//    To build, serve, and watch: gulp
//    To build only: gulp build
//    To build CSS only: gulp buildCss

view raw JSON →